Reading Code
From Salon:
"It's funny," says Dave Thomas, a Dallas software consultant and co-author, with Andrew Hunt, of "The Pragmatic Programmer," a 1999 book on software design methods. "Colleges spend a lot of time teaching people how to write code, but very few teach them how to read code. When you think about it, we programmers spend most of our time reading code, not writing code."
That's very true. Here I am with six multi-hundred page PDFs open, trying to work out what EFI, BMC, MP, etc mean...
I hear Tridge used to teach operating systems by (amongst other things) paging through files of the Linux kernel with emacs and etags, describing how different things worked. I think that would work a lot better (at least for the good students) than hearing vagueness about how things work in theory or writing toy programs. Writing toys and studying theory is important too, but I think many students miss the illumination of seeing actual large programs.
Ward Cunningham's Signature Survey program[,] a "method for browsing unfamiliar code," Signature Survey scans through source code and compresses lines of text into a single punctuation symbol. Operating on the assumption that a file's size is proportional to the number of punctuation marks separating individual elements (packages and files in Java, for example), Signature Survey offers a quick guide to programming thickets and areas of quick repetition.
"It's a satellite system for looking over large bodies of work," Cunningham says. "It lets you use your own human pattern recognition to see variation over the whole program. It also leads you to interesting parts of the program to read."
Thomas says his own preferred technique is to import a program's contents into Microsoft Word and reduce the zoom factor as far as it will go. The resulting 50-page image leaves little for the eye to make out other than jagged patterns of text and blank page. Still, even these patterns can reveal peculiar anomalies in developer mood or style. "Sometimes the structure is easier to see at that level than if you're digging around line-by-line," he says.
posted Fri 1 Aug 2003 in /software/management | link
Archives 2008: Apr Feb 2007: Jul May Feb Jan 2006: Dec Nov Oct Sep Aug Jul Jun Jan 2005: Sep Aug Jul Jun May Apr Mar Feb Jan 2004: Dec Nov Oct Sep Aug Jul Jun May Apr Mar Feb Jan 2003: Dec Nov Oct Sep Aug Jul Jun May
Copyright (C) 1999-2007 Martin Pool.