enjoying salad since 1978.

Wednesday, September 28, 2005

Self-documenting interfaces and having nice tools.

I used to prefer dynamic languages (specifically Python, Common Lisp, and Ruby) over Java for my spare-time coding projects. That's changed recently and I've come to realize it's because of generics and the smart for-loop in Java 5.

Since Generics arrived in Java, my code has a much cleaner feel to it. Imagine a class for generating Atom feeds. Instead of the Python code:

class Feed:
    def get_entries():
        return entries
In Java, the method signature would tell me everything
interface Feed {
    Iterable<Entry> getEntries();

Now I know immediately that what I will be getting can be shoved through a smart for-loop and the entries worked over like so:

for (Entry e: getEntries()) {

I had a good idea that the Python code would return a List (because I can see the return statement) but I'd have to run my tests to be sure it worked. With Java 5, I have a better chance at build self-documenting interfaces. I really like that.

I should probably also admit that IntelliJ IDEA has completely changed how I program in Java. I used to code with the following steps:

  1. make changes
  2. compile and wait forever.
  3. read compiler errors
  4. fix
Now it's more like:
  1. make changes
  2. look at the sidebar for red
  3. see red, go directly to the error
  4. fix

Same amount of steps but because of incremental compilation it's a small fraction of the former time and I never leave my editor.

I'm sure I'll write some gushing blog posts about IDEA and Java 5 in a few weeks. Papa's got a new bag.

(Sorry, that's the last time I'll call myself "Papa")

Monday, September 26, 2005

Jon Kleinberg's new Book

In honor of Jon Kleinberg's half-million dollar MacArthur Grant, I picked up his new book Algorithm Design. The first thing my coworker notices is a chapter on PSPACE. The first thing I notice is the discussion on Greedy Algorithms. The chapter starts out with a quote from the movie 'Wall Street': "Greed is.. good!"

Should provide some fun homework.

Sunday, September 25, 2005

Programmers Need To Learn Statistics Or I Will Kill Them All

"Programmers Need To Learn Statistics Or I Will Kill Them All"

Windows gets the testing religion?

From the Wall Street Journal:
The 53-year-old Mr. Allchin, who joined Microsoft in 1990 and is now co-head of the Platform Products and Services Division, says he always disdained the fast-and-loose culture of PC software.
And Microsoft's culture was facing a new threat. The mass of patches and agglomerations that made up Windows turned it into an easy target for viruses and other Web-based attacks. Mr. Allchin had to divert top engineers into the effort to fix security problems in existing versions of Windows. "The ship was just crashing to the ground," Mr. Allchin says.
So they took a page out of the XP handbook:
By late October, Mr. Srivastava's team was beginning to automate the testing that had historically been done by hand.
As engineers began cooperating and Mr. Srivastava's team worked overtime to refine the tools, the quality of the code flowing into Longhorn began to improve. The time to create a new "build" fell to just a few days, allowing a faster cycle of writing and testing new code. After the Windows group was able to install a workable version of the system on their PCs four days before Christmas, Mr. Srivastava says the group celebrated by not working over the holidays.
Good, maybe this can convince people at larger companies to produce software with an xUnit framework and not just a wish and a handshake.

Saturday, September 24, 2005

Amit Thinks.

Amit has found a major problem with Kurzweil's 'The Singularity is Near' theory. Basically, you can't use visualizations of scale-free functions to prove that anything is near because the knee moves as more data is viewed.

A Picture Share!

Birthday girls Jenna and Stacy (with 2-year old Carina to the left).

Thursday, September 22, 2005

A Picture Share!

Giant pocky. Instead of huge chocolate on huge wafer sticks, I picked up a melon soda and a multi-vitamin jelly in a space-age pouch.

Update: The Melon Soda was pretty awful. The multi-vitamin gel taunts me from the fridge. "Yes, try me. I won't hurt... much."

Thursday, September 08, 2005

Just like a punch in the face

Tonight I took the 21 MUNI line home. Bear with me here. The front was crowded as a dude was blocking the way. I excused myself and moved past him only to have him accuse me of pushing him. To "retaliate", he pushed me back. As I turned to figure out what was going on...


That son-of-a-bitch punched me square in the face. The chin to be exact. A nice solid punch. I haven't been punched in the face since college but times were different then: we were in a ring wearing boxing gloves so there was no element of surprise.

My bell was a little rung so I stepped back and asked something reasonable: Why did you punch me in the face?

His response was less reasonable.

So the other passengers started yelling at him and telling the drive to throw him off. I asked again: Why did you punch me in the face?

At which point, because of all the other passengers yelling at him, he started to flip out, saying that he was going to "tear this thing apart" (or something to that effect, things were a little hazy).

I felt it was best to get off the bus, go home, and file a police report.

That officer would like you to know that if something similar ever happens to you, tell the bus driver to immediately push their "panic button" (which I didn't know they had) and a bunch of cops will come immediately and arrest the guy.

Anyway, don't worry about me. My lip is swollen and a little bloody but will be fine after a few days of aspirin and ice. My pride is not bruised, I have not been turned into a frightened city dweller, and I'm glad I didn't do anything stupid.

Just remember that panic button.