View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Make it Work, Then Make it Fast

Lazy Optimization is an article by Ken Auer and Kent Beck about speeding up programs, especially Smalltalk programs. They talk not only about specific techniques, but also broader philosophical approaches. In general, they call the approach "Lazy Optimization", because you don't optimize until problems occur.

In contrast, there are probably advocates of a style where code is written as efficiently as possible to begin with, even if the code becomes more complicated.

Who is right? Is writing slow code just asking for it? Does anyone in the class have experiences regarding performance?

Great note! But nobody signed it! (sigh)

Alan Kay argues that even the FINAL version of the main code (e.g., main method, code in the abstract class that describes the overall algorithm, etc.) should be understandable, that optimizations should be behind the scenes (e.g., in implementation of lower-level methods, in concrete subclasses, etc.).

Another approach, that makes a similar point, is Don Knuth (inventor of TeX and MetaFont; overall genius about algorithms; Turing Award winner; Author of "The Art of Computer Programming") on his "literate programming." Knuth argues that programs should be written to be read as literature. This doesn't mean JUST lots of comments and good variable names, but that you should be able to write your program as an essay and have some post-processor pick out the code bits of your essay to create something compilable, and some other post-processor should generate the typeset version of your essay. More on Literate Programming at http://www.literateprogramming.com

But in both cases, an emphasis on READABLE CODE is being made here, which Kent Beck makes in eXtreme Programming, too. Mark Guzdial


A lot of people this semester Avoid Signatures :) -PatrickParker

is this a signature Rambo


No, but the following is. - Patrick Parker
(Follow-ups in Sandbox)

So, uh, what do you guys think about that optimization question?

I think Lazy Optimization is a good concept to start with. But just as the program should eventually become optimized somewhere over the course of its evolution– so should the programmer. Thus, only those who have practiced Lazy Optimization given a specific compiler and witnessed bottlenecks removed can predict with any accuracy how future bottlenecks will also be resolved. Until then, eliminate the paranoia and confusion associated with PrematureOptimization by ignoring optimization until the later stages of the program. –Patrick Parker




Link to this Page