Friday, March 25, 2005

Amazon Suggest

Apparently XMLHttpRequest is the next "god" object and AJAX will do to web development what XML did to, well, everything. Following the fine tradition of google suggest, this guy hacked together (in the original, and the best sense of the word "hack") "Amazon Zuggest", complete with graphics, personal history and global history. Pretty cool stuff. Or should I say, amazing ztuff?!

Wednesday, March 23, 2005

How to Start a Startup

I've dreamed of starting my own startup ever since grad school. At the time the inspiration was the story of this bunch of geeks from Stanford and Berkeley who put a workstation together with open system software and started selling it, and turned it into such a huge success that some of the founders retired before the age of 30. Well, you guessed it, it was Sun Microsystems.

Then I got out of school and landed a relatively stable job. The Internet bubble came and gone. Some of my friends joined startups, but none that I know of made it big so they could retire. The stories of yahoo, amazon, google became legends. And I've always kept my dream alive, just never executed it.

Here I am, reading Paul Graham's rant on how to start a startup. He set the upper age limit at 38 for someone to start a startup. I think I am ready.

Friday, March 18, 2005

Adobe Reader 7.0

I really hated Adobe Acrobat 6. Every time I click on a PDF link, the whole computer would freeze, and this splash screen comes on, showing it's loading millions of modules and plugins. It takes eternity to actually see the document.

Today I finally upgraded to Adobe Reader 7.0 (they dropped the "acrobat"). I am amazed how much optimization they've done on the startup time. The document almost comes up instantaneously. If you haven't upgraded, you should stop what you are doing and upgrade now.

Friday, March 11, 2005

(Dr. Seuss') The Hacker in the Diaper

When we moved into our first house last year, it had a security alarm system from the previous owner. We never bothered to hook it up with a monitoring service, so the whole system was sitting there unused.

Until last night, our two-and-half-year-old son somehow discovered he could reach the keypad near the front door (he is tall for his age), and started punching the keys like crazy. It was making all kinds of beeping sound, and my wife went and stopped him. So that was that.

Later that night I was going to Lowe's to pick up some gardening supplies. As soon as I opened the door into the garage, this ear-piercing alarm came on all through the house, something in the garage started blinking, our little hacker in the diaper started crying, while it was my turn to punch the keypad like crazy trying to stop the alarm. It was complete chaos, and for the life of me I couldn't stop the alarm, this ear-piercing, headache-inducing, baby-terrifying damn alarm. After trying different key combinations for a while, I finally gave up and went into the garage, flipped the main circuit breaker. The whole house went dark, and the alarm stopped! I counted to 10, and flipped it back on. I was fully expecting the alarm to come back on, as it was still ringing in my ears, but luckily it didn't. Feeling so proud of myself, I went back to get my car keys. The little hacker had calmed down and ready to go to bed, everything was back to normal. In his limited vocabulary, he was trying to point out the key fact that he only messed with the keypad next to the front door, while the alarm came on when I opened the door to the garage, so somehow it was my fault, not his. I didn't argue with him as I was trying to beat Lowe's closing time.

But you probably guessed it, as soon as I opened that door, the alarm came on again, fiercer than ever. That time I didn't hesitate and recycled the main power. Once again the alarm stopped, but I dared not to go out again. For the next 45 minutes, I was desperately googling for "resetting security alarm", running up and down the attic, inspecting the electrical enclosures in the master bedroom closet, and finally figured out how to cut the main power to the whole security system.

By that time our little hacker had fallen asleep, probably dreaming up his next big hack. And I had missed Lowe's closing time.

And I still haven't figured out how he alarmed the system in the first place. It's time to call up an alarm company.

Thursday, March 10, 2005

Meeting travelocity CEO

Yesterday I met with Travelocity's CEO, Michelle Peluso, and I was impressed. Travelocity is our sister company, so our manager got her to give us a "pep talk". Before I went, I thought it'd be another one of those boring, long-winded management speeches. It turned out to be anything but. She was honest, articulate and to the point. She talked about how when she first joined Travelocity we'd fallen far behind Expedia and not growing at all, and Orbitz was catching up fast. In the three years she's been here, Travelocity has turned around, they revamped everything, and now it's growing at a much faster clip than the competitors. She's really accomplished a lot, considering she's in her early 30's, and a female in a male-dominant conservative industry. But more than the financial numbers, more than the corporate culture she's built, the work hard and have fun attitude, it's the fact that she genuinely cares about each and every employee that's really precious in today's corporate environment.

From a technology point of view, the battle between Travelocity and Expedia is sort of like java vs. Microsoft. Travelocity was the innovator that started the whole online travel business, but had since fallen behind, and now is surging ahead with newfound vigor. Of course the Travelocity platform is built on top of java while Expedia is no doubt a Microsoft shop (Orbitz got some former LISP guys doing something weird :). If you are a good java/web guy living around the DFW Metroplex, Travelocity is the place to be.

Tuesday, March 08, 2005

Measuring OO-ness

Like most developers, I don't really care for software metrics. Writing good software is more like an art (or black magic, if you will) than an exact science. It takes years of learning and experience just to recognize good code, let alone writing it. A mathematical formula simply won't cut it for measuring code quality.

But still, I've always hoped that there'd be a simple method to determine how good an object oriented system is. The closest I've gotten was from a book (by Martin Fowler I think) that says something along the line, if you look at a good OO system, all the classes and methods are pretty small and simple and "don't seem to be doing anything"; it's through the interaction of these objects that complex behaviours emerge.

In our organization we have a separate "tools team" that does the builds for us. They use CruiseControl, bundled with everything under the sun: run unit tests and functional tests, provide test coverage reports through Clover, check coding standard using CheckStyle, run JDepend to analyze packages and cycles. But probably the most interesting is the class level design quality metrics produced by Essential Metrics. Of those the one that comes up most in our conversations is Cyclomatic Complexity.

Googling it will lead you to Software Engineering Institute's site that spits out a formula

Cyclomatic complexity (CC) = E - N + p

In reality it's a pretty simple concept. Cyclomatic complexity measures the number of decison points (if, else, for, while, switch etc) in each of your methods. The higher the number, the more complex your methods are, and in theory the more difficult it is to understand and maintain your system. The example I gave previously has a cyclomatic complexity of 7, which ranks at the top in our current small project.

But how is that related to how objected-oriented your code is? Well, over the years I've discovered that for a poorly designed OO system (if you can call it OO), it's almost impossible to avoid large amount of if's and else's, or worse, switch's. On the other hand, a well designed OO system (few and far between) has very light use of decision logic, usually only for checking boundary conditions (e.g. if argument is null). In other words, if your method is not "doing much", it probably has a low cyclomatic complexity.

low cyclomatic complexity == good OO code

As for the root cause of this, if you've come this far, you can probably figure it out yourself, right? :)