Given I like reading Source Code by the fire with my smoking jacket and brandy snifter, a list of books
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 read 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.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Seriously, great post, and with my meager experience, totally valid. Keep on, good sir . . .
I still learn something new every day I read code.
Great response Scott. Reading and reviewing code is one the most valuable (but least done) things a developer can do to improve one's own coding skills. I'm not sure why Jeff thinks it is of little use but having the discipline of regular code reviews is highly beneficial to keep the codebase readable. I think it's along the lines of his earlier posts on Programmers Don't Read Books -- But You Should.
Beside the obvious learning benefits, it is also one of the PCI compliance recommendations to have regular security code reviews (formal reading/commenting process) since not everything security related can be caught by automated application scans. To reiterate, reading code provides insight into thought process, classification technique and help you learn optimization techniques to improve your own code.
It just seems odd to disregard the entire post because of one dumb generalization.
I guess I would question one's passion for software engineering when they don't like reading source code. Like the soap opera doctor, perhaps he's not really a software engineer, but plays one on his blog.
That said, I will probably still read his blog, since everyone from time to time has nuggets of gold.
I have blogged a response to his post (http://priscimon.com/blog/2012/04/17/what-the-source-code/), and the short of it is that there are inherent risks to relying on source code as documentation for third-party libraries. First, there is the risk of building upon undocumented features that are not guaranteed to be future-proof. Second, encouraging the practice of using code as a first-class source of guidance diminishes the importance of producing good documentation, yet good API documentation is not only essential for productivity but is also a measure of how good a framework is. For example, as great as the .NET Framework is, without the wealth of documentation in MSDN, it wouldn't enjoy the same degree of adoption.
Eddy.
My interpretation is that he's saying most people might not be so passionate about their craft that reading source code each night seems more appealing than The Presidents Club, Hunger Games or whatever the cool kids are reading now. Rather, it is something that might grab people with a passing curiosity about a particular project, approach or style on occasion.
I think that people with a real thirst to learn and better their craft will likely derive a great satisfaction from learning from other peoples' examples, but perhaps the point here is that it would not ordinarily be considered a regular, exciting and stimulating passtime.
[Now off to categorise further into sipping code and gulping code]
Maybe I don't deal with it well, maybe I am in the wrong environment. But it hard to get interested in development when some of the things I used to face daily makes me want to cause physical harm.
I found a decent place now, and I like it. But I still find myself saying to myself "WTF!" or "WHY? WHY?", I found myself saying to another developer "This code would make the baby Jesus cry".
Most of the source I get to read on a daily basis is so bad, I don't want to look at any one elses code. It not that I don't want to learn, it is because I am tired and frustrated and just want to forget about it.
When I get home and If I want to look at code, It will be mine own that I will look at, because at least I think I have some control over that.
Sorry Scott but you happen to work with code where people care about quality.
Maybe it is time you went to
http://thedailywtf.com/
It helps you get better at "offline debugging" by training you to spot problems in code. So, not so much learning by looking at good code, more controlled exposure to bad code, for learning purposes.
Also, you'll sometimes find the source code of your favorite libraries actually pretty "sub-optimal." The token input jQuery plugin is excellent but its implementation is less than ideal. I rewrote the thing using Knockout and it uses way less code to do the same thing, plus it lets you use templates, choose what type of search you want, and probably more by the time I'm done.
I have found that nobody writes code or approaches problems like one's self. While I to have puked over poorly written code, I have come to realize that what is considered "normal" or "acceptable" is relative to one's self.
Passion is established when you desire to grow beyond your own normalcy. Otherwise you will find yourself stuck in a rutt.
So you're both right - it just depends on the code.
I appreciate this, but when you work in an environment where you just leave the office upset. All you want to do is forget about it.
Cheers,
Timothy
The Game Programming Gems series is excellent - like Beautiful Code it is one chapter / one author / one topic style. There are many book that cover writing a type of game - they build the entire game over the course of the book.
I stopped paying attending to Jeff's reading recommendations when he dismissed a Petzold book because it didn't have code examples in color. Kids these days...
Eddy Young and Phil got it.
Primarily, Jeff is advocating reading and understanding the source code as the primary form of documentation. I'm sure many people who have flamed him would agree with that.
I think the remark which has stolen the limelight somewhat is not entirely without merit however. Yes, it is great to read code and learn new techniques from it, but when I "settle down in a deep leather chair with [my] smoking jacket and a snifter of brandy" my idea of a good time is spending time with my family or tending to my other hobbies.
It peeves me greatly to hear people say that if you don't live and breath code 24/7 you are not a "real" or "passionate" developer.
It feels like all the post-Jobs soul searching about work/life balance seems to have been forgotten very easily.
You mentioned the book "Artificial Intelligence: A Modern Approach". I was happy to participate in a recent online class using that book, and it was taught by Peter Norvig (one of the authors) and Sebastian Thrun (leader of the Grand Challenge winning team, now at Google). Here's the address: https://www.ai-class.com/
Although the class is over, I believe anyone can still see the videos, and they help explain the concepts in the book A LOT. Both men are now teaching new classes at Udacity.com, and I'm looking forward to learning more from them in the future.
Comments are closed.