The Problem With Code Reuse and Abstraction
Currently I am neck deep in some multi-layered multi-moduled code that I inherited from some consultants. Younger developers who work with me are also upset with the convolutions, but they are convinced that their way of snapping together Lego blocks is vastly superior and much more maintainable. Just like the consultants though they believe that the more modular, abstract and generic they make their code – the better it is, even if they are building a one-off super specific application. Modularity and code reuse is their number one priority, only then followed by performance, brevity, and lack of bugs.
Development frameworks and code reuse that they promote seem to the the way things are going these days. I was reminded of this trend when I was reading this passage in Ian Bank’s “The Bridge” today:
“”Are there laws against what they did?”
“There’s no law to permit it, Orr, that’s the point. Good grief man, you can’t have people going off and doing things just because they want to, just because they think something up! You have to have a… a framework””
Don’t get me wrong, I am all for code reuse, abstractions and other such fineries. It’s just that I tend to look at certain tasks and think – there’s a piece of custom code needed here! The younger developers always look at me with great disapproval and tell me that I should use module X or Y, or how they are working on a module that will cover all problems of this kind in a generic way.
Today I came upon a perfect metaphor for such thinking. Apparently it originated from an origami forum, but it seems to me I encountered it in Fidonet signature years ago. In any case, the quote goes like this:
“An elephant consists of a trunk, ears, and a hippopotamus”.
When you are building things out of Lego blocks, you must fight the temptation to substitute a hippo for the starting point of an elephant. It looks like Lego did mess up the young minds just the way Sir Harold Kroto said when he delivered a crotch punch to the Lego sales:
“New toys (mainly Lego) have led to the extinction of Meccano and this has been a major disaster as far as the education of our young engineers and scientists is concerned. Lego is a technically trivial plaything and kids love it partly because it is so simple and partly because it is seductively coloured. However it is only a toy, whereas Meccano is a real engineering kit and it teaches one skill which I consider to be the most important that anyone can acquire: This is the sensitive touch needed to thread a nut on a bolt and tighten them with a screwdriver and spanner just enough that they stay locked, but not so tightly that the thread is stripped or they cannot be unscrewed.”
If I knew about some of the things that were lurking in the codebase I’m working with now, I’d work something like this into my hiring contract:
“In April of 2000 while on a business trip I received a near-frantic email from someone with an unusual request. It seems that she represented a fellow with a company in Seattle (no, NOT Microsoft). Turns out that last September this guy was hired, and in his contract of employment it stipulated that he wanted a desk made out of LEGO.”
Sometimes I am also reminded of other classics of early Internet literature.