Editors: Andy Oram, Greg Wilson
Publisher: O'Reilly (1st ed. June 2007)
Review by: Cosimo
Rating:
Date: 2008/05/01
This book is probably not like what you expect it to be.
I was curious to read some of the existing reviews about it, and they turned to be really interesting, especially the negative ones. Seems like somebody didn't find step-by-step instructions to produce beautiful code. Of course not.
This is a kind of book that tries to show the insight, the original thinking and programming process of the various authors. It's not a "Beautiful code for dummies".
And as such, it is a rather "fragmented" book. Each chapter is from a different author, so don't expect a common structure or anything. The common topic is the author's own idea of "beautiful code", being that performance, simplicity, elegance, insight, or whatever.
There's an astonishing quantity of programming stars, starting with the first chapter, "A Regular expression matcher" by Brian Kernighan, going through Jon Bentley, Charles Petzold, Lincoln Stein, Greg Kroah Hartman, Simon Peyton Jones, Douglas Crockford, Yukihiro Matsumoto, and many others.
There are plenty, from low to high level. Some examples:
Also several different programming languages, from C, to Perl, Haskell, PHP, Python, LISP, even pseudo-code.
I read this book some time ago, so I don't remember perfectly every detail. But this can be good, because the things that stick into mind after a long time are probably the best ones... :)
Bentley dissects his version of the classic quicksort algorithm, and shows how to take little steps to improve a working version of a program. He also explains, in a not-too-formal way, how to analyze algorithms behaviour and performance.
Test driven development and JUnit testing. Savoia takes a binary search implementation in Java and shows how to test it properly with edge cases, smoke testing, random data and automated performance testing.
"All computer science problems can be solved with another level of indirection". This is a famous quote. This chapter shows how this principle is applied in the FreeBSD virtual filesystem layer.
Detailed description of how the author helped fix a thread deadlock bug in the soon-to-be-released Solaris 8 kernel. An interesting reading for a complex and tricky problem.
Excellent! Worth the whole book. Zeller is one of the current developers of ddd, the Data Display Debugger. He shows how he debugged his own debugger with a general purpose, automated "brute-force" debugging process, the Delta Debugging algorithm.
The birth and development of eLocutor, a unique user interface software thought for professor Stephen Hawking.
This is one (maybe the only one) that talks about beautiful code in the sense of source code text. How to write good code from a stylistic point of view. Comes from the experience of the authors as developers of DiffMerge, a component of Perforce SCM.
You can also read this full chapter on Perforce web site.
There are really many more, and in fact, every chapter is well worth reading.
I really like this book approach. It's definitely not always an easy read. And be prepared, because it's a full 600 pages book...
Each author tells about his own idea of beautiful code, and shows
the steps he went through to reach the final result. In other cases,
the author describes the architecture of that particular system from
a high-level point of view.
In any case, it is this kind of "enlightening" that can be valuable
for programmers. It's more about ideas than code.
A great book. Every now and then I come back to read again some particularly brilliant chapter. It's like buying a graphics book, you can always look at it to find inspiration.