The Importance of Short Feedback Cycles
Posted by Ben Jackson Wed, 19 Oct 2005 22:54:00 GMT
I've been thinking a lot lately about the relationship between compilation time and developer productivity, and I've come to a conclusion: if you're waiting for more than 5 or 6 seconds from the time you hit the compile button to the time you receive the information you're looking for, you are short-changing yourself big-time.
Version 1.0 of my agency's website was built and compiled entirely in the Flash IDE. This was not a problem when I started the project: with a handful of classes and only a couple of sections for the first round of betas, compile times were not an issue, and I was able to move fairly quickly while adding new features and fixing the hoards of bugs that popped up as I got a handle on the process of developing in an environment which, until that point, had meant little more to me than a timeline and drag-and-drop scripting.
Fast-forward to launch. With more than a hundred classes and a library crammed full of assets, many linked to AS2 classes which extend MovieClip, I was waiting between 30 seconds and a minute and a half for each compile. That's right, a minute and a half. I've heard stories of large apps that took up to 4 minutes for each compilation. Needless to say, my development process was less-than-agile. I found myself scanning and rescanning my code after every single change to make sure that I hadn't misspelled a variable name, or misplaced a comma, or made any other innocent mistake that would cost me precious minutes while I waited for the compiler to complain.
These epic compilations had another, even more drastic side effect. Rather than sit in front of the monitor watching the infernal blue bar dance hypnotically back and forth as the IDE pored over each and every one of my classes and library assets, even those which had not changed, I naturally shifted my attention to other, less pressing matters: checking to see if that fan-mail I sent to Günther got a response, reorganizing my home directory for the umpteenth time, or catching up on the latest additions to Monkey Hot or Not. Needless to say my productivity went through the floor.
Recently I spent a couple of sleepless nights figuring out how to do automated builds with Rake and MTASC for Flash development. I can say, without exaggeration, that the time I spent in automating my build process and converting my codebase to compile with MTASC has paid off tenfold in less than a month. I have reduced my compilations from 45 seconds on average to less than 10 to build my entire project from scratch, including the time spent building my configuration files with the nifty YAML2XML script I whipped up, running all of my dynamic text through Markdown, and syncing images and other assets to the build directory with rsync. The time spent actually compiling my code takes more like 2 or 3 seconds, and on average I end up waiting about 5 seconds from the moment I hit cmd-return before seeing my swf pop up in the Flash Player, which nicely enough is barely enough time for me to switch over to NetNewsWire and read a paragraph or two off the latest 43Folders post.
Some simple math goes a long way towards illustrating my point. Assuming that I perform about 300 compilations a day (a reasonable estimate), if my average compile time is 45 seconds then I'm spending 3 hours and 45 minutes of time that I don't have to spare waiting for the machine to process my code. Cut that down to an average of 5 seconds and my daily compilation time is down to less than half an hour. Over a normal month (say 22 workdays) that adds up to 71 and a half hours of time saved. Let me repeat that: almost two entire work-weeks per month suddenly free for me to plan new business opportunities, draft my latest blog post, and drown my newfound productivity in The Onion's hilarious archives.
I see a lot of parallels here with the gains in designer productivity over the last few years with increases in CPU speed and faster image processing algorithms. I remember back in the days of Photoshop 5 when using the brush tool on a 300dpi image felt like carving in stone with a butter knife. Being able to get immediate feedback from your machine leads to a fundamental shift in the design process; in the graphic designer's case, we are now free to experiment in ways that were never possible when the size of our image exceeded the available RAM on the box. Similarly, the shorter your compilation times are, the more freedom you have to throw a quick print statement in that nested function to make sure it's working exactly as you expect it would, without littering your code and your log with a bunch of shots in the dark due to the massive overhead of compiling.
I've gone off on a bit of a rant here, but I'll sum it up by saying this: invest in hardware, invest in your build process, and don't be a slave to the machine. Your projects, and your sanity, are worth it.
