I recently read an article bemoaning the lack of “reading courses” in programming. Such a course would be analogous to, say, a “20th Century American Literature” course in an English curriculum, but instead of literature, the students would read great programs, discuss the stylistic and technical choices that were made, and so forth. This seems like a good idea to me; most programming that you see in school is quite short and narrowly focused. The opportunity to see how a good developer approaches Programming In The Large is a good one.
On that note, here’s an article that discusses (in a near-literary way) the code that John Carmack wrote for Doom 3.
If you’re not familiar with his body of work, John Carmack is the technical core of id Software, which (as far as I’m concerned) invented the 3d first-person video game. At the time, desktop computers were just becoming powerful enough to do 3d, and the only 3d rendering that you’d typically see are “spinning goblet” demo apps used to show off the graphics capabilities of the box in question. Carmack and company had to implement the 3d algorithms from scratch based on some very dry academic publications (I had one of them as a course text in grad school, and I’ve seen it described as an “ox-stunner”; I would not dispute that). id Software went on to a string of successes (Wolfenstein, the Doom franchise, the Quake franchise, Rage, etc). Beyond their own games, their game engine is licensed by many other game companies. And oh yeah, he builds rocketships in his spare time.
OK, enough about John Carmack. Read the article, read the source code, and see what you think.