Beautiful Code

So this book sat around while I read it, reread and thought. The idea is simple - as programmers, we don't spend a lot of time studying each others' code. This dooms us to reinvent each others' work and to repeat their pitfalls. The fix — find some expert programmers, and get them to write about 'beautiful code' — elegant and eloquent code that should be examples to us all. There are 33 chapters, each writen by a different author or pair of authors.

Each of the authors can be said to be an expert in their field, though you may not have heard of them if you don't look at that field. The same could be said about the ideas — map/reduce, for example, isn't very useful outside parallel programming. The same point could be drawn about the ideas — anyone who has looked at implementing a file system at some point knows that the system calls are best implemented by function pointers. A experienced programmer will find content that he knows, that may seem clear and simple to him, but will also find new ideas and approaches.

Some of those ideas may seem controversial. I would be surprised to find a programmer who agreed with all of the book's content. However, like many good books and blogs, it is thought provoking. During the time I had the book to review, I found myself changing my opinion of one chapter — Tim Bray's — based on trying to encourage co-workers to adopt his ideas more. I had started out thinking they were trivial and clear to everyone, but on worked out that they weren't. A point could be made about many of the chapters, and ideas in general, being like that.

A strong point of the book is its large collection of experienced authors — no one author could have put together such a collection. However, it is also its weak point. Styles are different, lengths of chapters are different. The fundamental idea varies from chapter to chapter. for exaple, Simon Peyton Jones talks about a technique for concurrent programming in Haskell, Karl Fogel talks about a certain API inside subversion, and Jon Bentley talks about just one algorithm. However, that's only a minor point. I'd suggest it can be turned into a strong point by reading each chapter seperatly - each also may need thought and programming before its done.

Some of the chapters, to give you a feel: A discussion from Brian Kernighan about how to implement REs - This is a area covered in theorical computer science and compiler courses, but often lacking from other programmer's knowledge base. Its a key point, perticlarly if you use then and have to debug performance problems with them. Quicksort — a discussion of one of the fundamental algorithms in CS, Python's dict implementation: a key feature of the lauguage and a great example of how to tune a data structure. A tour of Software transactional memory, a technique for doing connertent programming from its author, a look inside both the solaris kernel and the Linux kernel, and many more besides.

It has weak chapters — Yukihiro 'Matz' Matsumoto's chapter doesn't inspire the reader much, and has a air of stoping written in a hurry. There are mistakes, but a reader will find them.

In conclusion, then I'd recommend this book for programmers who both already know a couple of languages and want to learn more techniques. Be prepared to encounter stuff you already know, and to think that the authors are wrong. I wouldn't suggest it for starting programmers, or for people who don't want to learn new things. If you liked Unix power tools, then this is the start of a programming equivalent.

Happy hacking!

Score: 9/10

Pete Nuttall


External Links

Compsoc Wiki
Compsoc Library

Upcoming Events

There are no upcoming events planned. Check the CompSoc Wiki in case of emergency

RSS | iCal


No Starch Press
Durham Students Union

Random Poll

What time is it now?

View results
Submit a new poll
All polls

This section exists to trap prefetching clients. Please just ignore it if you have css disabled and thus can see this. Do not click this link unless you want us to think you are a bot