Beautiful Code is a collection of essays from some well known software engineers. I was really looking forward reviewing this one because of the interest I have in other people's ways of solving problems. To make it short: It's an amazing book. And it is very hard to read. If you are thinking about buying it, make sure you have the time to deep dive into it, otherwise it will only be a nice, blue spine in your rack.
Book: Beautiful Code - Leading Programmers Explain How They Think
Language : English
Paperback : 624 pages [9.1 x 7.1 x 1.2 inches ]
Release Date : June 2007
Publisher: O'Reilly Media; 1 edition (June 26, 2007)
Edited By: Andy Oram, Greg Wilson
The book was put together by Andy Oram and Greg Wilson. Both names, I have not heard before. Let's get a hand on their biography (Taken from an Safari Books Online Interview with both). Andy Oram is an editor at O'Reilly Media specializing in free software and open source technologies. His work for O'Reilly includes the first books ever published commercially in the United States on Linux, and the 2001 title Peer-to-Peer. Andy is also a member of Computer Professionals for Social Responsibility and writes often for the O'Reilly Network and other publications on policy issues related to the Internet and trends affecting technical innovation and its effects on society.
Greg Wilson holds a Ph.D. in Computer Science from the University of Edinburgh, and has worked on high-performance scientific computing, data visualization, and computer security. He is the author of Data Crunching (Pragmatic Press, 2005) and Practical Parallel Programming (MIT Press, 1995), and is a contributing editor at Doctor Dobb's Journal, and an assistant professor in Computer Science at the University of Toronto.
It's a quick and easy beginning. After 25 pages of preface, contents and some reading information you get started by chapter 1 which is written by Brian Kernighan and is about "A Regular Expression Matcher". The chapter itself has 10 pages and describes in detail the algorithms and approaches to implement the topic. It happens, that you hit the first sorcecode on page 27. No big surprise. If you are through this, you have a brief impression what to expect in the following 32 chapters. Each of them is organized independently and you have to spend a couple of hours with each to fully understand it. An excerpt of what is waiting for you:
Chapter 2, Subversion's Delta Editor: Interface as Ontology, by Karl Fogel
Chapter 3, The Most Beautiful Code I Never Wrote, by Jon Bentley
Chapter 8, On-the-Fly Code Generation for Image Processing, by Charles Petzold
Chapter 10, The Quest for an Accelerated Population Count, by Henry S. Warren, Jr.
Chapter 16, The Linux Kernel Driver Model: The Benefits of Working Together, by Greg Kroah-Hartman
Chapter 18, Python's Dictionary Implementation: Being All Things to All People, by Andrew Kuchling
Chapter 23, Distributed Programming with MapReduce, by Jeff Dean and Sanjay Ghemawat
Chapter 28, Beautiful Debugging, by Andreas Zeller
And there are many more chapters in it.
Writing and Style
It has been a hard time for me as a non native speaker following the different authors. Each has a slightly different style and even if the editors did a great work with them it gets very theoretical and you have kind of academic writing to work through to understand everything completely. The fact, that every chapter has a different structure also makes this a hard read.
Nearly every chapter uses a different programming language. You come across Haskell, Java, C++, pseudocode, Python and some more. Even if an experienced programmer should be able to understand any dialect, you have to find your reading speed through the book. This is hard sometimes. Another point which slowed down my reading speed are the equitations. If you like them. Perfect. There are more of them in there. And if you are willing to experience the beauty behind the solutions, you have to understand them.
To be honest. I did not had too much. I was looking for some very decent solutions of other programmers. I was willing to look at their way of solving problems and I was hoping to be surprised with a couple of unusual experiences. That worked for me. You can find examples of some very interesting problem domains with working solutions. The people delivering the content for the book play in a league of their own and after reading a couple of chapters I fully understand one of the answers from the editors in the safari books online interview:
Safari: What was the most challenging part of putting together Beautiful Code?
Wilson: Believe it or not, it was persuading people that they actually had something to contribute. Many of the authors' first reaction when we approached them was, "That sounds great, but I don't think I've ever written any code I'd call 'beautiful'."
Conclusion and recommendation
If you are looking for beautiful code: Buy this book. But be prepared. It's not an easy read and don't expect to simply read through it. The best part is: You don't have to. It's chapters are readable one by one and you don't miss a bit, if you start with 33 or simply focus on the parts you like the most.