UCOSP

Undergraduate Capstone Open Source Projects

Lost in a Twisty Maze of Little Subroutines, All Alike

Posted by Greg Wilson on 2009/09/21

Many great computer scientists and educators have observed that while we teach students to write code, we don’t teach them to read it [1]. When you think about it, it’s ridiculous: architects study hundreds of buildings before designing one of their own, novelist probably read thousands of books before trying to create their own masterpiece [2], and only mathematicians can count how many proofs they go through in detail during their training, so why don’t programmers study great programs to improve their craft?

One of the few people who’s actually done something about this is Diomidis Spinellis. His two books Code Reading and Code Quality are respectively an explanation of how to read large C/C++ programs meant to build and run on Unix, and how to tell good code from bad code. Both are worth reading, as is his blog.  Just last week, for example, he described how he tracked down a bug in a regular expression library. I tried to do something last year when I recorded myself reading through a medium-sized piece of Python. I’d be very interested in pointers to similar material, i.e., to examples of people reading and reviewing code in public.

[1] I’ll award 5 millimarks each to the first three people to find quotes online to back this up.

[2] Though in Dan Brown’s case, it doesn’t appear to have helped.

One Response to “Lost in a Twisty Maze of Little Subroutines, All Alike”

  1. onitony said

    Bill Gates, in Programmers at Work.

    [T]he best way to prepare is to write programs, and to study great programs that other people have written. In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system. You got to be willing to read other people’s code, then write your own, then have other people review your code. You’ve got to want to be in this incredible feedback loop where you get the world-class people to tell you what you’re doing wrong.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: