Beautiful Code: Leading Programmers Explain How They Think [NOOK Book]


How do the experts solve difficult problems in software development? In this unique and insightful book, leading computer scientists offer case studies that reveal how they found unusual, carefully designed solutions to high-profile projects. You will be able to look over the shoulder of major coding and design experts to see problems through their eyes.

This is not simply another design patterns book, or another software engineering treatise ...

See more details below
Beautiful Code: Leading Programmers Explain How They Think

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99 price
(Save 44%)$35.99 List Price


How do the experts solve difficult problems in software development? In this unique and insightful book, leading computer scientists offer case studies that reveal how they found unusual, carefully designed solutions to high-profile projects. You will be able to look over the shoulder of major coding and design experts to see problems through their eyes.

This is not simply another design patterns book, or another software engineering treatise on the right and wrong way to do things. The authors think aloud as they work through their project's architecture, the tradeoffs made in its construction, and when it was important to break rules.
This book contains 33 chapters contributed by Brian Kernighan, KarlFogel, Jon Bentley, Tim Bray, Elliotte Rusty Harold, Michael Feathers,Alberto Savoia, Charles Petzold, Douglas Crockford, Henry S. Warren,Jr., Ashish Gulhati, Lincoln Stein, Jim Kent, Jack Dongarra and PiotrLuszczek, Adam Kolawa, Greg Kroah-Hartman, Diomidis Spinellis, AndrewKuchling, Travis E. Oliphant, Ronald Mak, Rogerio Atem de Carvalho andRafael Monnerat, Bryan Cantrill, Jeff Dean and Sanjay Ghemawat, SimonPeyton Jones, Kent Dybvig, William Otte and Douglas C. Schmidt, AndrewPatzer, Andreas Zeller, Yukihiro Matsumoto, Arun Mehta, TV Raman,Laura Wingerd and Christopher Seiwald, and Brian Hayes.
Beautiful Code is an opportunity for master coders to tell their story. All author royalties will be donated to Amnesty International.

Read More Show Less

Product Details

  • ISBN-13: 9780596554675
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 6/26/2007
  • Series: Theory in Practice (O'Reilly)
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 620
  • Sales rank: 1,085,256
  • File size: 6 MB

Meet the Author

Greg Wilson has worked on high-performance scientific computing, data visualization, and computer security, and is currently project lead at Software Carpentry ( Greg has a Ph.D. in Computer Science from the University of Edinburgh, and has written and edited several technical and children's books, including "Beautiful Code" (O'Reilly, 2007).

Andy Oram is an editor at O'Reilly & Associates, specializing in books on Linux and programming. Most recently, he edited Peer-to-Peer: Harnessing the Power of Disruptive Technologies.

Read More Show Less

Table of Contents

Dedication; Foreword; Preface; How This Book Is Organized; Conventions Used in This Book; Using Code Examples; How to Contact Us; Safari® Enabled; Chapter 1: A Regular Expression Matcher; 1.1 The Practice of Programming; 1.2 Implementation; 1.3 Discussion; 1.4 Alternatives; 1.5 Building on It; 1.6 Conclusion; Chapter 2: Subversion's Delta Editor: Interface As Ontology; 2.1 Version Control and Tree Transformation; 2.2 Expressing Tree Differences; 2.3 The Delta Editor Interface; 2.4 But Is It Art?; 2.5 Abstraction As a Spectator Sport; 2.6 Conclusions; Chapter 3: The Most Beautiful Code I Never Wrote; 3.1 The Most Beautiful Code I Ever Wrote; 3.2 More and More with Less and Less; 3.3 Perspective; 3.4 What Is Writing?; 3.5 Conclusion; 3.6 Acknowledgments; Chapter 4: Finding Things; 4.1 On Time; 4.2 Problem: Weblog Data; 4.3 Problem: Who Fetched What, When?; 4.4 Search in the Large; 4.5 Conclusion; Chapter 5: Correct, Beautiful, Fast (in That Order): Lessons from Designing XML Verifiers; 5.1 The Role of XML Validation; 5.2 The Problem; 5.3 Version 1: The Naïve Implementation; 5.4 Version 2: Imitating the BNF Grammar O(N); 5.5 Version 3: First Optimization O(log N); 5.6 Version 4: Second Optimization: Don't Check Twice; 5.7 Version 5: Third Optimization O(1); 5.8 Version 6: Fourth Optimization: Caching; 5.9 The Moral of the Story; Chapter 6: Framework for Integrated Test: Beauty Through Fragility; 6.1 An Acceptance Testing Framework in Three Classes; 6.2 The Challenge of Framework Design; 6.3 An Open Framework; 6.4 How Simple Can an HTML Parser Be?; 6.5 Conclusion; Chapter 7: Beautiful Tests; 7.1 That Pesky Binary Search; 7.2 Introducing JUnit; 7.3 Nailing Binary Search; 7.4 Conclusion; Chapter 8: On-the-Fly Code Generation for Image Processing; Chapter 9: Top Down Operator Precedence; 9.1 JavaScript; 9.2 Symbol Table; 9.3 Tokens; 9.4 Precedence; 9.5 Expressions; 9.6 Infix Operators; 9.7 Prefix Operators; 9.8 Assignment Operators; 9.9 Constants; 9.10 Scope; 9.11 Statements; 9.12 Functions; 9.13 Array and Object Literals; 9.14 Things to Do and Think About; Chapter 10: The Quest for an Accelerated Population Count; 10.1 Basic Methods; 10.2 Divide and Conquer; 10.3 Other Methods; 10.4 Sum and Difference of Population Counts of Two Words; 10.5 Comparing the Population Counts of Two Words; 10.6 Counting the 1-Bits in an Array; 10.7 Applications; Chapter 11: Secure Communication: The Technology Of Freedom; 11.1 The Heart of the Start; 11.2 Untangling the Complexity of Secure Messaging; 11.3 Usability Is the Key; 11.4 The Foundation; 11.5 The Test Suite; 11.6 The Functioning Prototype; 11.7 Clean Up, Plug In, Rock On…; 11.8 Hacking in the Himalayas; 11.9 The Invisible Hand Moves; 11.10 Speed Does Matter; 11.11 Communications Privacy for Individual Rights; 11.12 Hacking the Civilization; Chapter 12: Growing Beautiful Code in BioPerl; 12.1 BioPerl and the Bio::Graphics Module; 12.2 The Bio::Graphics Design Process; 12.3 Extending Bio::Graphics; 12.4 Conclusions and Lessons Learned; Chapter 13: The Design of the Gene Sorte; 13.1 The User Interface of the Gene Sorter; 13.2 Maintaining a Dialog with the User over the Web; 13.3 A Little Polymorphism Can Go a Long Way; 13.4 Filtering Down to Just the Relevant Genes; 13.5 Theory of Beautiful Code in the Large; 13.6 Conclusion; Chapter 14: How Elegant Code Evolves with Hardware The Case of Gaussian Elimination; 14.1 The Effects of Computer Architectures on Matrix Algorithms; 14.2 A Decompositional Approach; 14.3 A Simple Version; 14.4 LINPACK's DGEFA Subroutine; 14.5 LAPACK DGETRF; 14.6 Recursive LU; 14.7 ScaLAPACK PDGETRF; 14.8 Multithreading for Multi-Core Systems; 14.9 A Word About the Error Analysis and Operation Count; 14.10 Future Directions for Research; 14.11 Further Reading; Chapter 15: The Long-Term Benefits of Beautiful Design; 15.1 My Idea of Beautiful Code; 15.2 Introducing the CERN Library; 15.3 Outer Beauty; 15.4 Inner Beauty; 15.5 Conclusion; Chapter 16: The Linux Kernel Driver Model: The Benefits of Working Together; 16.1 Humble Beginnings; 16.2 Reduced to Even Smaller Bits; 16.3 Scaling Up to Thousands of Devices; 16.4 Small Objects Loosely Joined; Chapter 17: Another Level of Indirection; 17.1 From Code to Pointers; 17.2 From Function Arguments to Argument Pointers; 17.3 From Filesystems to Filesystem Layers; 17.4 From Code to a Domain-Specific Language; 17.5 Multiplexing and Demultiplexing; 17.6 Layers Forever?; Chapter 18: Python's Dictionary Implementation: Being All Things to All People; 18.1 Inside the Dictionary; 18.2 Special Accommodations; 18.3 Collisions; 18.4 Resizing; 18.5 Iterations and Dynamic Changes; 18.6 Conclusion; 18.7 Acknowledgments; Chapter 19: Multidimensional Iterators in NumPy; 19.1 Key Challennnnnnges in N-Dimensional Array Operations; 19.2 Memory Models for an N-Dimensional Array; 19.3 NumPy Iterator Origins; 19.4 Iterator Design; 19.5 Iterator Interface; 19.6 Iterator Use; 19.7 Conclusion; Chapter 20: A Highly Reliable Enterprise System for NASA's Mars Rover Mission; 20.1 The Mission and the Collaborative Information Portal; 20.2 Mission Needs; 20.3 System Architecture; 20.4 Case Study: The Streamer Service; 20.5 Reliability; 20.6 Robustness; 20.7 Conclusion; Chapter 21: ERP5: Designing for Maximum Adaptability; 21.1 General Goals of ERP; 21.2 ERP5; 21.3 The Underlying Zope Platform; 21.4 ERP5 Project Concepts; 21.5 Coding the ERP5 Project; 21.6 Conclusion; Chapter 22: A Spoonful of Sewage; Chapter 23: Distributed Programming with MapReduce; 23.1 A Motivating Example; 23.2 The MapReduce Programming Model; 23.3 Other MapReduce Examples; 23.4 A Distributed MapReduce Implementation; 23.5 Extensions to the Model; 23.6 Conclusion; 23.7 Further Reading; 23.8 Acknowledgments; 23.9 Appendix: Word Count Solution; Chapter 24: Beautiful Concurrency; 24.1 A Simple Example: Bank Accounts; 24.2 Software Transactional Memory; 24.3 The Santa Claus Problem; 24.4 Reflections on Haskell; 24.5 Conclusion; 24.6 Acknowledgments; Chapter 25: Syntactic Abstraction: The syntax-case Expander; 25.1 Brief Introduction to syntax-case; 25.2 Expansion Algorithm; 25.3 Example; 25.4 Conclusion; Chapter 26: Labor-Saving Architecture: An Object-Oriented Framework for Networked Software; 26.1 Sample Application: Logging Service; 26.2 Object-Oriented Design of the Logging Server Framework; 26.3 Implementing Sequential Logging Servers; 26.4 Implementing Concurrent Logging Servers; 26.5 Conclusion; Chapter 27: Integrating Business Partners the RESTful Way; 27.1 Project Background; 27.2 Exposing Services to External Clients; 27.3 Routing the Service Using the Factory Pattern; 27.4 Exchanging Data Using E-Business Protocols; 27.5 Conclusion; Chapter 28: Beautiful Debugging; 28.1 Debugging a Debugger; 28.2 A Systematic Process; 28.3 A Search Problem; 28.4 Finding the Failure Cause Automatically; 28.5 Delta Debugging; 28.6 Minimizing Input; 28.7 Hunting the Defect; 28.8 A Prototype Problem; 28.9 Conclusion; 28.10 Acknowledgments; 28.11 Further Reading; Chapter 29: Treating Code As an Essay; Chapter 30: When a Button Is All That Connects You to the World; 30.1 Basic Design Model; 30.2 Input Interface; 30.3 Efficiency of the User Interface; 30.4 Download; 30.5 Future Directions; Chapter 31: Emacspeak: The Complete Audio Desktop; 31.1 Producing Spoken Output; 31.2 Speech-Enabling Emacs; 31.3 Painless Access to Online Information; 31.4 Summary; 31.5 Acknowledgments; Chapter 32: Code in Motion; 32.1 On Being "Bookish"; 32.2 Alike Looking Alike; 32.3 The Perils of Indentation; 32.4 Navigating Code; 32.5 The Tools We Use; 32.6 DiffMerge's Checkered Past; 32.7 Conclusion; 32.8 Acknowledgments; 32.9 Further Reading; Chapter 33: Writing Programs for "The Book"; 33.1 The Nonroyal Road; 33.2 Warning to Parenthophobes; 33.3 Three in a Row; 33.4 The Slippery Slope; 33.5 The Triangle Inequality; 33.6 Meandering On; 33.7 "Duh!"—I Mean "Aha!"; 33.8 Conclusion; 33.9 Further Reading; Afterword; Contributors; Colophon;

Greg Wilson holds a Ph.D. in Computer Science from the University of Edinburgh, and has worked on high-performance scientific computing, data visualization, and computer security. He is the author of Data Crunching and Practical Parallel Programming (MIT Press, 1995), and is a contributing editor at Doctor Dobb's Journal, and an adjunct professor in Computer Science at the University of Toronto.

Andy Oram is an editor at O'Reilly Media, a highly respected book publisher and technology information provider. An employee of the company since 1992, Andy currently specializes in free software and open source technologies. His work for O'Reilly includes the first books ever published commercially in the United States on Linux, and the 2001 title Peer-to-Peer. His modest programming and system administration skills are mostly self-taught.

Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Posted January 14, 2011

    more from this reviewer

    This book is a challenging and inspiring read for new and seasoned programmers.

    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.

    Was this review helpful? Yes  No   Report this review
  • Posted January 14, 2010

    I Also Recommend:

    Experts Discuss Their Favorite Topics

    This is quite a good book, although not every topic will appeal to every reader. Because this is a collection of papers by individual authors, there is some variation in tone and writing quality from section to section.

    I enjoyed seeing what each contributor felt to be an especially noteworthy case study, and learned a lot from several of the chapters. A handful of offerings were somewhat less interesting, but the book is large enough that most readers should find enough solid content to be worth the asking price.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted September 2, 2007

    A great peek into some truly brilliant minds

    This book was designed as a way for modern programmers to show how they think: why should a system be designed one way and not another? What makes code beautiful? This book is organized into 33 different chapters, where leading programmers pick a software topic that is beautiful to them, then proceed to describe what makes it so. This book is a fascinating insight into the minds of some leading programmers. The authors cover many different topics: from Subversion¿s Delta Editor to Python¿s Dictionary implementation from the enterprise system behind the Mars rover to some design decisions behind Ruby. Again, these are all fascinating to look at, but the breadth of material is so varied that it might be difficult for a lot of individuals to really get into. Lead programmers or software architects will likely eat this stuff up, but it¿ll probably be too much for the average working software developer. If you are able to get past the fact that each chapter comes from an entirely new author with an entirely new project, this is an interesting book and a great peek into some truly brilliant minds.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)