I heard about Beautiful Code, by Andy Oram and Greg Wilson a few years back, but haven’t had the chance to read the book until now. It was worth the wait. This book is a challenging and inspiring read for new and seasoned programmers.
The editors of Beautiful Code were able to take some of the top programmers of our era and pick their brains on what they considered to be beautiful code. The result of this endeavor is a book that covers a wide range of topics: from recursion in processing regular expressions to interface design. Each chapter isn’t particularly lengthy, but they all follow a similar pattern. First, the background and issues surrounding a problem are outlined. Next, some (if not all) of the code that solved the issue is provided. Finally, analysis of why the code works is explained. More importantly, each chapter also outlines why the code is beautiful. Sometimes it is the clever use of a common programming practice that makes the solution beautiful. Other times it is the algorithm that produced the code that makes things beautiful. Each chapter is unique in this regard.
This book is not for the casual reader. There are a lot of complex situations covered in this book. Likewise the code used to solve these situations can be equally complex. However, it is reading through these complex pieces of code with their analysis that you gain a greater appreciation of programming. It will give you concepts and code for future use. It can also give insight to problem solving techniques you might have not though of before.
Students can use this book to see what problems they will face outside of the academic setting. Intermediate programmers can use this book to refresh themselves of core concepts and how to implement them in an elegant way. Veteran programmers can appreciate the problems faced and even see inspiration as they continue in their career. Beautiful Code is an instant classic to read and reread.
You can get this book through O’Reilly Books at http://oreilly.com/catalog/9780596510046/