Jeff had a blog post yesterday (seems everything he writes in his retirement gets on Hacker News as well) about reading source code. While Jeff's post is largely a pull-quote of a post on Hacker News by Brandon Bloom, one bit stuck out to me as I'm sure it did to others.
"The idea that you'd settle down in a deep leather chair with your smoking jacket and a snifter of brandy for a fine evening of reading through someone else's code is absurd." - Jeff Atwood.
Absurd? Hardly. Nearly every programmer I've ever spoken to enjoys reading and discovering new code. I've been advocating that Developers need to read as much code as they write for at least half the time I've been blogging (10 years now, as of yesterday.) How could you not be excited about reading source with all the wonderful open source that's available in the world today?
In fact I have an entire category of my blog called the "Weekly Source Code" with 58 different specific entries at last code. That's 58 different great opportunities to read and learn from another programmer, some good some bad.
The idea that reading source code is absurd is really the wrong message to send. Here's a list of interesting books about source and source code that I'd recommend you settle down in your leather chair, stoke the fire and read.
- Beautiful Code: Leading Programmers Explain How They Think (Theory in Practice (O'Reilly)) - The new classic. One chapter, one developer, and one famous program or problem. The chapter on a tiny regular expression parser is worth the price of the book.
- Computers & Typesetting, Volume B: TeX: The Program - I've only read about 1/3 of this in uni in the library. It's pretty heady stuff but a fascinating look into the algorithms that a practical genius uses to set type.
- Design Patterns: Elements of Reusable Object-Oriented Software - A classic of the 90's, this book includes stories and examples from four professional programmers presented as a series of 23 patterns for creating Object Oriented software.
- Operating Systems Design and Implementation (3rd Edition) - The original "Minix" book that taught me all about *nix systems in a tiny way in college. Much easier to jump into than the full Linux source code and even easier today with the advent of Virtual Machines. One of our homework assignments was to write a new file system driver. The version I had even had the complete system source code in the back of the book!
- Programming Pearls (2nd Edition) - Love love love this book. Practical low level discrete and brilliant examples of how smart people solve hard programs. This book is actually in my bathroom which is high praise, in fact.
- Case Studies in Common Lisp - Free and online, this 1992 book includes not only an intro to Common Lisp but also great examples and lots of code.
- Artificial Intelligence: A Modern Approach - I try to great this book (lots available online) every two or three years but I'm not smart enough to handle it. But I'm going to keep trying.
Of course, you don't need to buy any of these books or pay for anything. Just read code. Read your coworkers code, your company's code, your favorite open source library's code. Don't stop reading code.
The Weekly Source Code was weekly but then become "whenever I get the time." Because of Jeff's article I'm going to get a smoking jacket and brandy snifter and start doing new Weekly Source Code posts every week. Ok, it will be a Code Zero snifter but you get the idea. Because you can't be a good writer coder if you aren't a good reader.
© 2012 Scott Hanselman. All rights reserved.