November 6, 2007
Follow me on Twitter

NeoVictorian Computing 6: Honest Materials, Exposed Joints

The NeoVictorian programmer works with myriad small pieces of code, connecting them in complex ways. She doesn't want or need to hide the segmentation or to cover up the joints.

NeoVictorian Computing 6: Honest Materials, Exposed Joints
Burnham and Root's Rookery Building, remodeled by Frank Lloyd Wright, photo by Willy Feng

The classical ideal was the unbroken column and the functional subroutine: call it once with the proper arguments and receive your answer. I remember programs that were vast stacks of cards, 3000 per box; I wrote a game that ran to fifteen boxes and had thousand-line modules.

Over the span of a generation, the size of our pieces has shrunk and the parts of proliferated. Modular programming suggested that subroutines fit on a page; in John Hsoi Daub's excellent PowerPlant framework (used in Tinderbox), it's quite common to find methods like LPOP3Connection::GetOneMessage that run to 60 or 80 lines of code. The smallest method body in LPOP3Connection is four lines, and that's unusual. All of our object code used to look like this: big objects with big methods.

We don't write this way very much nowadays. Agile Methods have something to do with it. So does refactoring.

A core cause, though, is a change in materials; just as the production of cheap cast iron transformed Victorian architecture, the discovery that method calls need not slow the program transformed the way we think about objects. And then there's test driven development: small objects and small methods are much easier to test, and the advantages of pervasive testing for avoiding reversion bugs are compelling. (I've never been a fan of methodologies and I hate anything that slows down coding, even type declarations. But Test Driven Development really has transformed my code work.)

If you're going to have lots of small parts and lots of small methods, closeup views are going to seem complicated. If you're going to build an office building or a railroad station out of small pieces of iron and steel, you're going to have lots of members and lots of rivets.

You might try to hide the complexity. But NeoVictorians ask, "why?" The parts are there. The rivets are there. Covering them with a facade makes them seem simpler, but if you need to poke holes in the facade for testing and to get the objects to do what you want, the facade becomes a sham -- a frilly cover that's supposed to hide the legs but just attracts dust.