Thursday, September 26, 2013

New Programming Jargon:"Reptile Code"



With New Programming Jargon Jeff Atwood added all the modern programming metaphors to the  Jargon File. With Reptile Code i would like to propose one myself.

In "The Science of Discworld (1)" [1], chapter Mammals on the Make, biologist Jack Cohen elaborates on of one of science's remarkable misjudgments. At this time, the concept of DNA was often referred to as Blueprint of life. And it still is today:



It seemed to be a natural conclusion to approximate a species' level of evolution or its complexity by the length of its DNA strand, i.e. the longer the DNA code the more sophisticated the species.

This intuitively made sense. By analogy, the engineering blueprint of Jumbo Jet is a lot longer than that of a simple paraglider.


The embarassing result: Empirically, the DNA of a frog is much longer than the human DNA. Confusion took hold. Could it be that God considered simple reptiles higher than his flagship creation, man?

Later, it was found that human DNA is so much shorter because it is organized better [2].
Put simply, frog DNA contains a variety of contingency plans for environmental changes that accumulated in the course of evolution as lots of code patchwork. For instance,
if temperature between -14° und -7° do this,
else if between -7° and 0° do that,
else if ... etc.
Warmbloods like man escape this complexity through the elegant statement
set internal temperature to 36°.
Especially for developers, i find this view very accessible, because they very well know about metrics like Lines of Code (LoC) oder Cyclomatic Complexity (McCabe) from their own experience [3].

Hitting such code, you could probably say in Mr.Spock voice:
Fascinating! This component is likely to be hard to maintain: The average cyclomatic complexity of their methods differ with 57.63 significantly from that of the World Code Health Organization (WCHO) which recommended a maximum 20.
Compared to Mr. Spock just stating
Woah! Reptile Code!
really hits home and feels more natural.

Footnotes:
  1. As a teenager i loved reading Terry Prattchet Discworld-novels, especially the series Science of Discworld which were written together with co-authors Ian Stewart und Jack Cohen and which uniquely prescribes the wonderful cosmology of Roundworld and is amongst the best introductory works on evolution after Richard Dawkins.

  2. Later, it turned out that DNA-Code at times can "reorganize" and shift to a whole new organizational level of abstraction. It seems, evolution knows the concept of "refactoring" but she is a lot more cautious on eliminating "dead code" (perhaps of the deep coupling of SCM and the code itself).

  3. In general, long codes with a high McCabe-Complexity are a lot harder to maintaint, cf.:

Links:

No comments:

Post a Comment