Wednesday, March 02, 2005

Representation

The Mythical Man Month: Essays on Software Engineering (Brooks), like Elements of Style (Strunk and White), has a proud place on my shelves. Brooks book is now thirty years old; I have the twentieth anniversary edition, which is still in print. The technical references are dated; the ideas about writing, design, and engineering organization remain fresh.

The last section of the chapter Ten Pounds in a Five-Pound Sack is titled Representation is the Essence of Programming. The section begins with these words:

Beyond craftsmanship lies invention, and it is here that lean, spare, fast programs are born. Almost always these are the result of strategic breakthrough rather than tactical cleverness. Sometimes the strategic breakthrough will be a new algorithm, such as the Cooley-Tukey Fast Fourier Transform or the substitution of an n log n sort of an n2 set of comparisons.

Much more often, strategic breakthroughs will come from reduing the representation of the data or tables. This is where the heart of a program lies. Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious.

The terms flowcharts and tables are dated (in The Cathedral and the Bazaar, Raymond substitutes code and data structures); but the meaning remains relevant. Representation is the essence of programming. It is also the essence of physics, of engineering, of mathematics, and of written language. When I build a physical model, which details do I include, and which do I ignore? Do I write equations for particle dynamics or wave mechanics, or something completely different; and can I go from one to the other when it makes my life easier? When I learn how a microprocessor is designed, do I think about a billion transistors, or about caches and pipelines and arithmetic units?

Our impression of the world comes through our senses; our understanding of the world comes through the representations we build from those impressions.

  • Currently drinking: Coffee