Recently, my wife and I went to the local Borders, and I saw O'Reilly's Beautiful Code. Since the book has sat in my Amazon queue for months, I was excited to get a chance to peruse it. So, I gleefully sat down, cracked the cover, and proceeded to read a number of chapters.
I'll save you some time and just tell you that the book was supremely disappointing. With the exception of the first chapter, I felt the book was entirely "missable". In fact, I would venture to say that the only piece of truly "Beautiful Code" I found in the whole book would be Brian Kernighan's (with help from Rob Pike) regular expression engine. To me, it is an inspired piece of code. It shows a simple regular expression engine in 30 lines of C code. It shows the beauty and power of C with a practical and elegant solution to a real world problem. Wow.
Now, I admit, not everyone is Brian Kernighan or Rob Pike, but I felt let down by Beautiful Code. I felt most of the submissions were just pieces of code that the authors yanked from their projects and decided to talk about. None of them were as generic, widely applicable, or beautiful as that by Kernighan.
I might end up buying Beautiful Code anyway since it's for a good cause. I doubt I'd ever re-read it though.
{ 2 } Comments
I’m a “Beautiful Code” author, and I absolutely agree with the assertion that the book is highly variable. But — in part due to that variability — I think it’s hasty to dismiss the entire book based on browsing it in a bookstore. Speaking personally, I was surprised by some of the chapters that I found most valuable. (And also quite disappointed by other chapters that I thought would be valuable but didn’t end up being terribly interesting.) For whatever it’s worth, I blogged my thoughts on the book here: http://blogs.sun.com/bmc/entry/on_the_beauty_in_i
I also happen to not completely agree with you about the Pike code, in part because it is broken for some classes of pathological input. I blogged about that here: http://blogs.sun.com/bmc/entry/beautiful_code
I hope you do end up buying (or otherwise reading) the book, if only because it would be interesting to read the resulting rants — many of which I would probably agree with…
Bryan:
Quoting you:
I completely agree with this assertion. Perhaps others would get more from this book than I did in my (admittedly quick) perusal.
I particularly like your observation that the book is probably best digested with a discussion group. The first time I read Sutter’s Exceptional C++, I started it in a discussion group format, and found that to be quite educational.
Additionally, reading your comments regarding recursion and the stack — you’re dead on; however, I think even Kernighan points this out in the chapter. (He certainly points it out in the original Dr. Dobb’s article.)
All in all, I’m not trying to bash Beautiful Code. Really, I was just disappointed with what I saw when I was excited to finally get my hands on it.
Post a Comment