2005/10/06

Reading source code for edification, entertainment and shock value


I came across this by one of the greats:developerWorks : Blogs : Grady Booch: "I've mentioned this before, but no one bit on my comment: in universities, there are fine arts courses in reading the classics, but I've yet to see a technical course in selected readings of software source code.
"

I was somewhat surprised, given Grady's background, that the emphasis was on code rather than design ( unless he has converted to the "code is the design" way of thinking)

I certainly think the literate programming style would encourage code reading by highlighting key passages, perhaps discussing alternatives etc.

I did a quick google for "reading source code"; there were a couple of universities pointing at chunks of source code to be read. These also reminded me of the language sensitivity of the source reading approach - I have forgotten so much C that it was difficult to spot the key issues.

And I found this - perhaps this is why we don't read source code:
We Are Morons: a quick look at the Win2k source:

In the struggle to meet deadlines, I think pretty much all programmers have put in comments they might later regret, including swear words and acerbic comments about other code or requirements. Also, any conscientious coder will put in prominent comments warning others about the trickier parts of the code. Comments like "UGLY TERRIBLE HACK" tend to indicate good code rather than bad: in bad code ugly terrible hacks are considered par for the course. It would therefore be both hypocritical and meaningless to go through the comments looking for embarrassments. But also fun, so let's go.

No comments: