About the Reviewer
Rick Wagner lives in Arkansas with his beautiful wife and 3 energetic kids.  Rick loves to explore software development tools and techniques, and really enjoys working through challenging problems.  Rick's a Sun Certified Enterprise Architect and a member of the International Association of Software Architects.
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.

Beautiful Code



Author(s) Edited by Andy Oram & Greg Wilson
Publisher O'Reilly http://www.oreilly.com/
PubDate 2007, 1st edition
Reviewer Rick Wagner
Purchase and help Javalobby



Table of Contents




One Minute Review

Positives
  • Offers advice and insights from a cast of stellar programmers.
  • Covers a wide variety of topics, almost everybody should find something familiar and something completely new.
  • Contains real code snippets and author's opinions of what makes a particular piece of code good and how it was written.
  • 593 pages of sage programming advice.
Negatives
  • Some topics are so esoteric they're hard to read.
  • Not a quick read-- this book requires time to study each topic. There are no easy chapters here.

Sections

Intent & Audience

This book is for serious developers and generous purchasers who want to benefit Amnesty, International. (All author royalties went to Amnesty, International.) The worth of this book is maximized for readers that love to write (and read) code.

back to top Back to top

Relevance of material

For a dedicated professional programmer, this book is very relevant. It gives a glimpse into the thought process of several industry luminaries-- some are humble, some are not, some get the big solution right immediately (or write as if that were so), some freely show how their 'beautiful code' evolved over time. For the true professional programmer, this book is relevant and unique in it's purpose.

back to top Back to top

Chapter highlights

Chapter 1: A Regular Expression Matcher
This chapter shows how elegant (and sparse!) a well-written routine can be. Industry giant Brian Kernighan demonstrates elegance in code written by his colleague Rob Pike. An excellent chapter that shows the thought process of a truly great programmer.

Chapter 2: Subversion's Delta Editor: Interface As Ontology
Shows the worth of a well-considered API. Some chapters in this book cover programming at a very low level, some a little higher-- this chapter is one at the higher end of the spectrum.

Chapter 3: The Most Beautiful Code I Never Wrote
Perhaps best summed up by the quote, "The cheapest, fastest, and most reliable components of a computer system are those that aren't there." This chapter strives to demonstrate this in action.

Chapter 4: Finding Things
Gives excellent technique for locating sought after items in a mountain of data. This problem is one common to many programmers, and especially those that tend care for production applications, so this chapter alone made the book worthwhile. This in no way diminishes the rest of the chapters, but rather serves to demonstrate value to programmers serving in all sorts of capacities.

Chapter 5: Correct, Beautiful, Fast (in That Order):
Lessons from Designing XML Verifiers Elliotte Rusty Harold shows how code evolves over time. One reason I really liked this chapter was the humble manner in which it was authored, showing even the greatest programmers find room for improvement once in a while.

Chapter 6: Framework for Integrated Test: Beauty Through Fragility
Shows elegance can sometimes be found in unconventional implementations.

Chapter 7: Beautiful Tests
I really, really like automated unit tests and might have considered myself well-practiced in the usage, but no longer! This chapter shows several different ways to think about your unit testing, all of them excellent. Another chapter worth the price of the book!

Chapter 8: On-the-Fly Code Generation for Image Processing
Demonstrates usage of specialized algorithms operating at a very low level when performance is at a premium.

Chapter 9: Top Down Operator Precedence
Gives a good overview of writing a parser, in this case used for JavaScript. It's easy to see how the parser produced in the writing of this chapter could be extended, for ambitious readers.

Chapter 10: The Quest for an Accelerated Population Count
This chapter covers a seemingly simple problem, but goes deep into the lower levels in the quest for a great implementation.

back to top Back to top

Chapter 11: Secure Communication: The Technology Of Freedom
Is a comprehensive outline of the birth of a secure messaging system. Some chapters in this book dive deep, others cover abstractions at a higher level-- this chapter is good example of the latter.

Chapter 12: Growing Beautiful Code in BioPerl
Explains a graphics library that can be used to help visualize data that otherwise might be lost in the raw form. The library is implemented in Perl, and this chapter starts at ground-zero for those new to the language. Before I'd read this chapter, I wouldn't have imagined Perl for use in this way, but I surely can see it now!

Chapter 13: The Design of the Gene Sorter
Describes a CGI script called the Gene Sorter that gathers information about genes, categorizes them, and provides hyperlinks to additional information. The chapter gives a good overview of what the application had to do, the toolset used to solve the problem, and some of the considerations that formed the end result.

Chapter 14: How Elegant Code Evolves with Hardware The Case of Gaussian Eliminion
Shows how what we consider beautiful code must change with time, especially with major shifts in machine architecture.

Chapter 15: The Long-Term Benefits of Beautiful Design
Takes the pragmatic viewpoint that code that works well is beautiful. The selected library is the CERN mathematical library, and the author makes excellent points by demonstrating this code is beautiful in it's brevity, frugality, and flow. This chapter also provides an interesting counterpoint to the previous chapter's assertion that time must change our definition of beauty.

Chapter 16: The Linux Kernel Driver Model: The Benefits of Working Together
Shows how contributions from many coders have shaped the workings of the Linux Kernel. Most chapters highlight individual's contributions, so this is a bit of a change in that way.

Chapter 17: Another Level of Indirection
Explains some of the pros and cons of using layers of abstraction. As a concrete model, this chapter uses the FreeBSD's interaction with file systems.

Chapter 18: Python's Dictionary Implementation: Being All Things to All People
Discusses the Python Dictionary, which provides a mechanism for mapping keys and values. This data type can be found in other languages, so the challenges discussed are relevant and interesting even for non-Python coders. Interesting!

Chapter 19: Multidimensional Iterators in NumPy
NumPy allows Python users to manipulate multi-dimensional arrays, which certainly allows for some interesting design decisions. This chapter describes different use cases for the routine and how an elegant API was crafted to allow it's use.

Chapter 20: A Highly Reliable Enterprise System for NASA's Mars Rover Mission
Before I started this chapter, I read the title and thought I was in for a detailed discussion on solving problems of the sort I'd never see. Surprise! It turned out the architecture used for the case study closely resembles many common business scenarios. The author provides a strong case for the beauty in an application architecture that surely must have many siblings in less exotic contexts.

back to top Back to top

Chapter 21: ERP5: Designing for Maximum Adaptability
This chapter demonstrates beauty at the very high end of the low-level/high-level spectrum, showing how a large-scale (VERY large-scale) application works from the 10,000 foot level.

Chapter 22: A Spoonful of Sewage
Is an especially timely chapter for developers, as it enumerates some of the hazards of concurrency in multi-threaded programming. This chapter shows that sometimes a beautiful solution is simply the one that works.

Chapter 23: Distributed Programming with MapReduce
Provides an easy-to-understand overview of Google's proprietary Map-Reduce framework and some excellent use cases for solving problems in this highly scalable environment. Enough to send non-Googlers scrambling to Hadoop for a look!

Chapter 24: Beautiful Concurrency
Gives some great coverage to concurrency problems and a reasonable introduction to Haskell.

Chapter 25: Syntactic Abstraction: The syntax-case Expander
A great chapter for those that like to write and understand language tools like compilers. This chapter examines issues around Macro expansion.

Chapter 26: Labor-Saving Architecture:
An Object-Oriented Framework for Networked Software Shows how higher-level abstractions found in design patterns (who'd have thought of those as higher-level?) can be applied to tweezer-level code down in the network.

Chapter 27: Integrating Business Partners the RESTful Way
Shows the beauty of a simplified alternative to going the whole-SOAP-hog route. Good, pragmatic advice for those building an XML interface into their applications.

Chapter 28: Beautiful Debugging
A really enjoyable chapter I thought was going to be about debuggers, but turned out instead into an overview of attacking problems logically. Very good reading.

Chapter 29: Treating Code As an Essay
The man who authored the Ruby language explains some of the things that make code beautiful-- and on the way gives insights into how a language can help facilitate beauty.

Chapter 30: When a Button Is All That Connects You to the World
Brings to light some really interesting questions of usability, when heavy constraints are applied at the onset of application planning. There are lessons here for designers of all types of applications, especially those that have a lot of user involvement.

Chapter 31: Emacspeak: The Complete Audio Desktop
Shows how Lisp's advice facility-- similar in many ways to Aspect Oriented Programming-- is used to speach-enable a visual interface.

Chapter 32: Code in Motion
Gives excellent, well structured advice on how to write code so future generations can read and maintain it. For a programmer working on a long-lived application (and who doesn't hope for the security that brings?) this is invaluable advice. Future coders (and maybe even yourself, after you've forgotten what you had written) will thank you for reading this chapter.

Chapter 33: Writing Programs for "The Book"
Gives an interesting walk through solving algebraic problems with Lisp. I especially enjoyed reading how the author reviewed different possibilities for solving problems along the way, then refining the answer by applying the best of what's available.

back to top Back to top

Rating

For the serious programmer, this book should have a place on the must-read list. (Caveat: be prepared to spend some time, unless you've mastered several languages and are in the habit of understanding abstract and complicated ideas from brief textual descriptions. If you still think you can read through it quickly, you might spend some time studying the humility of some of the industry giants who have written here.) For a rating, this book is given the maximum value due to the wide range of topics surveyed and the quality of the content.

Relevance
Readability
Overall

back to top Back to top

Resources

http://beautifulcode.oreillynet.com/
http://www.oreilly.com/catalog/9780596510046/

Purchase this book on Amazon and help Javalobby.