|
|
Beautiful CodeI got a copy of Beautiful Code to review from Manfred Moser, leader of the Vancouver Island Java User Group. Overall, I enjoyed reading Beatiful Code. It is quite diverse, as each chapter is written by a different author, on a different subject, so it is bound to have something good for every reader. The focus on beauty is what is supposed to bring them together, but given that beauty is in the eye of the beholder, the only thing really pervasive throughout the book is the admiration of the authors for one or more aspects of the subject they write about. As samples of what you will find in the book, I briefly describe below a few of the book chapters: Chapter 1, by Brian Kernighan (the 'K' of K&R C), describes the search for the best implementation of a regular expression matcher for a book he was writing (The Practice of Programming) through several iterations. The fact the code should appear in a book imposed several constraints: space, readability, pedagogy, usefulness, non-triviality. Every iteration provides insights on ways of improving code to make it more efficient and powerful, yet preserving brevity and readability. Chapter 6, by Michael Feathers, describes Ward Cunningham's FIT, a minimalistic and down-to-earth test framework. FIT is a test framework that proves that 'clean and simple framework' does not have to be an oxymoron. Feathers states that FIT is an important example of framework because it trades choice for simplicity, control for unlimited extensibility, and teaches us the benefits of those trade-offs. Chapter 18, by Andrew Kuchling, presents Python's Dictionary implementation, that as any generic data structure, needs to provide the best performance for the most common scenarios while performing reasonably well for non-usual scenarios. Kuchling shows that Python's Dictionary implementation provides special accomodations that favor certain access patterns and collection sizes (as do many collections in the standard Java class library), and that does not have to make the code ugly. Chapter 23, by Jeff Dean and Sanjay Ghemawat, describes MapReduce, Google's middleware that provides distributed applications with fault tolerance, parallelization and load-balancing. MapReduce is a remarkable system, and this chapter does a good job at describing how to develop applications based on it. Chapter 29, by Yukihiro "Matz" Matsumoto (the creator of the Ruby programming language) tells us that many of the attributes of a good essay also apply to code: brevity, conservatism, simplicity and flexibility, using his brainchild as an example. Beautiful Code seems the rare kind of computer programming book that tends to resist well the test of time; while it is quite technical and full of code samples, the ideas being discussed are mostly independent of the programming language in question. I liked most of the chapters that I have read. A few were less interesting. And others I decided to skip because they covered a problem domain and/or a programming language I am not familiar with and have no interest in learning about. But that is just me. Had I owned the book, I would eventually read all chapters. |