Sunday, March 2, 2008

Lessons in Lean (1)

When I wrote the Fingerspeller Flashcards, I thought I should pre-load the graphics (and the dictionaries) so that when a character is displayed, it is available instantly.

This had a small problem with it: Each alphabet, say ASL, has 26 to 30 images (actually more, since each letter needs at least 2 images) and each image is 30KB. So I had 1 MB of images plus the program (another 200KB), so all in all some 1.2 MB of data had to be downloaded before the program was ready to go.

This has a major disadvange: With a 128Mbit/s ISDN internet connection (very fast dialup, equal to 16 KByte/s), it took at least 75 seconds to get the application ready to go. Even my 3.5 Mbit/s Cable connection needed almost 4 seconds (although 4 seconds is fast enough that I didn't think about it much). But the long delays made the program unusable for most of my users.

The program only displays one letter at time. But it was downloading all the images in advance, just in case one was needed, and this meant none were available for a minute and half (and even a basic DSL line needed 40 seconds), longer than most users are willing to wait. If it would load just what it needed, it could be ready much sooner.

This is like writing detailed specifications before you start implementing. You have so much specification, just figuring out where to start take a significant amount of time. You can't see the forest for the trees. And because everything is "Must have", the whole project must be finished any value can be obtained from the project.

This is the biggest drawback of the procurement process as practiced by the Swiss government and other big institutions. Massive, very detailed specifications produce huge projects which must be implemented in their entirety before they can be used at all. A product that can't be used has no return on investment.

Time to ROI is probably the most under-appreciated cost factor in software projects.

How did I solve my problem? Easy: load the images on demand. There is a delay of 1.5 seconds between the point when I know I need the image and when I actually have to display it, which at 128Kbit is enough to download 24KBytes. This is "Just in Time" Delivery.

So I changed to code load images only on demand, and did some other compression on the HTML and javascript. In the second iteration, I reduced the image size from 30K to 15K. Result: The start page now needs about 2.7 seconds to load on a 128K line.

I need to find a way to get the images down to 8K (suggestions on how to do so would be most welcome!) to make the process really robust, but the improvement was immediately visible in my Google Analytics stats.

This is Lean Thinking. Eliminate waste, focus on delivering value, and improve continuously. This is also Scrum, with its plan - do - evaluate - improve loop, which focuses on implementing the most important functionality this month, getting it done, and then repeating process next month.

0 comments: