I wish that Bobby Fischer taught more
June 10, 2008 6:05 PM   Subscribe

Give me Bobby Fischer Teaches Chess for reading code.

My university programming courses taught me to write code, but my internship has shown me that I'm still terrible at reading it. I'd like a book in the style of chess tactics trainers, full of what's-wrong-with-this snippets, preferably in C or C++.
posted by tylermoody to Computers & Internet (8 answers total) 9 users marked this as a favorite
 
Exceptional C++ and its sequels are just what you're looking for. They contain programming puzzles of the "what's wrong with this code?" type.
posted by pravit at 6:21 PM on June 10, 2008


I scratch my "what's wrong with this snippet" itch here.
posted by fantabulous timewaster at 6:23 PM on June 10, 2008 [1 favorite]


Code Complete is a great text for some of the real nuts and bolts of coding.

As for getting better at reading code, let me paraphrase something I had heard second hand from a comics convention. A fan boy asked a prominent artist how he too could become a prominent artist. The answer was to get a really big stack of paper and a lot of pencils and start drawing.

Same thing.

Whenever I start working with other people's code for the first time, I usually step through the whole flow with the debugger. I've gotten to the point where I can pretty much tell you what OS the coder has spent most of his/her time on strictly by the style of the code (as opposed to the OS calls). Recognize nuance in the coding. Some people write code to be read. Some people write code to be fast. Some people write code to be terse. Some people write code to be clever. Ask yourself what the code is whenever you read it. Spot the design patterns. Spot the redundant work better spent in library routine. Spot the useful abstractions. Spot the gratuitous ones. Be critical.
posted by plinth at 6:54 PM on June 10, 2008 [2 favorites]


I haven't seen the 2nd edition but when it first came out, Code Complete was the best design/coding book around. So this is a seconding of plinth's recommendation.
posted by storybored at 8:13 PM on June 10, 2008


Also, I've been a long time out of the industry, but there must be some open source projects that have a reputation for coding excellence...someone else who's up on the latest might be able to help here...
posted by storybored at 8:16 PM on June 10, 2008


Code Complete is a great text for some of the real nuts and bolts of coding.

Absolutely positively. I actually finished reading the 2nd edition yesterday morning and damn, it's great. The only thing I didn't like was that I took this long to read it.
posted by Nelsormensch at 8:19 PM on June 10, 2008


When faced with a piece of code that I really need to understand, I sometimes start by rewriting it line-by-line in the way I would have done it.
posted by grouse at 3:08 AM on June 11, 2008 [1 favorite]


Code Reading: The Open Source Perspective by Diomidis Spinellis
is what you're looking for. Teaches code reading specifically with lots of examples in C.
posted by mausburger at 11:06 PM on June 11, 2008


« Older Regex woes.   |   Religious Defections Newer »
This thread is closed to new comments.