I just finished reading Beautiful Code, from O’Reilly. It isn’t like most technical books; like the others in the ‘Beautiful’ series, it’s more a collection of essays on a topic than a book. This is probably a better format than a book for these types of issues - there isn’t really one way for code to be beautiful, and so O’Reilly figured that the best way to transmit what beautiful code is was to get a wide range of opinions.
Beautiful Code has 33 essays by different - and very talented - software developers. Some of the more famous ones are Brian Kernighan, Matz, andd Greg Kroah-Hartman. Whether you read the essays in order or sporadically doesn’t matter - There is no dependence on previous chapters in any of the essays. Essays are on average less than 20 pages long, making them easily readable in short sittings. The overarching topic is code, not architecture, although some of that makes it in the book as well, so almost every chapter has code fragments that are being discussed.
Not all of the essays are going to be interesting to every person, although I still read all of them. For example, I didn’t particularly enjoy the essays on code written in bioinformatics packages. I do suspect that every person will like a different subset of the essays, and enough of them are incredibly good to make the book well worth reading.
My favourite essays in the book would have to be Brain Kernighan’s ‘A Regular Expression Matcher’, Andrew Kuchling’s chapter on Python’s dictionary implementation, and Andreas Zeller’s essay on delta debugging. These were very informative and gave very good examples of what beautiful code is, as well as in the last case a very cool idea for automated debugging. There were no more than five essays I was really not interested in, leading to a very interesting read.
All in all, Beautiful Code is well worth reading. It has contributions from the C, Lisp, Emacs, Haskell, Perl, and Python communities, as well as others. It gives a wide range of things to consider when making code beautiful, and many of the chapters explain very interesting concepts, such as implementing scheme’s hygienic macros, instead of small code samples that aren’t used anywhere outside the book. I’m glad I read it.