In Enrico Coen’s The Art of Genes (Oxford University Press, 1999), there is a really good metaphor for the “prototype” or abstract class in Java. It’s a complicated source domain to explain a rather simple (but deep and abstract) concept – but I think it’s a worthwhile one because the metaphor’s source may be illuminated as much for biologists as the target is or them and everyone else.
First the metaphor: As Coen explains, there are four key parts of a typical flower: besides the petals which everyone is familiar with, there are the stamens (which you may remember from biology class are small stem-shaped bits that produce the pollen), the carpels (which you may not remember – I didn’t – are long skinny protrusions that receive pollen), and the sepals (small, leaf-like green bits near the base of the flower). These four organs are typically arranged in four concentric circles called “whorls.” By studying mutant flowers – for example, some with an extra set of stamens in the petal whorl, some with extra petals in the stamen whorl – biologists were able to determine that there are merely three proteins whose presence or absence (at particular times) lead these various flower parts to distinguish themselves.* When just one protein, let’s say A, is present, the plant produces only sepals in all 4 whorls; if only C is present the plant produces only carpels in all 4 whorls. If all three of these proteins are missing (but others are present which define the location of a branching point), the plant produces a stem where a flower should be. Coen asserts that protein markers similarly account for distinctions between all plant parts, each marker causing a distinct set of characteristics on top of a basic pattern:
“It is perhaps not too difficult to imagine that sepals are [based on] leaves because they usually have a very leaf-like appearance. Petals are also not so different from leaves, give or take a bit of shape and colour. But what about sex organs? The male organs (stamens) do not bear any obvious resemblance to leaves. In the case of female organs (carpels) we sometimes get a faint leaf-like appearance when they have been fertilised and grow into fruits or pods containing seeds: a pea pod could be thought of as a leaf that has been folded lengthways and had the edges stuck together. But what about a tomato? Slice a tomato cross-wise and you will see two or more segments, each containing seeds. Is a tomato several leaf-like organs joined together?” (page 58)
Coen explains that the famous German poet Goethe was the first to recognize the parallels between the various parts of a plant – Coen’s quote from Goethe:
“it came to me in a flash that in the organ of the plant which we are accustomed to call the leaf lies the true Proteus who can hide or reveal himself in all vegetal forms.” (page 57)
As highlighted by the word “prototype” (Coen notes that Proteus is a sea god of Greek and Roman mythology fabled to assume various shapes), what Goethe was referring to was not a leaf as manifested in a green flat thing we are all used to seeing on trees, but rather an abstraction that has some characteristics of leaves but not necessarily any or all of them.
In programming terms, a prototype is an abstract class which requires some parameters to be defined before it can be instantiated. In programming, calling on a “concrete” class (for example a bicycle, which has attributes like its color and speed) is like turning out a copy from a factory, with definite defaults (in this case, black and zero). But using an abstract class is more tricky because it can’t be instantiated directly, but only in the context of other attributes. For example, if the abstract class is “ProteusLeaf”, you can use it to help make a peapod, a sepal, or a leaf, but you can’t add it directly to a stem with no further instructions on how to instantiate it.
I think the metaphor may be equally illuminating in the other direction because Coen suggests that the concept of a “leaf” in Goethe’s sense is still (as of 1999) not universally understood as the commonality between multiple forms, rather than any particular, expressed, or extant form:
“What exactly is a leaf, this common theme that is continually being depitcted by the plant? There seems to be no meaningful way to pursue the problem other than by saying it is that which is common to all plant organs. This seems to be evading the issue. It was for such reasons that Goethe’s ideas were often considered to be mystical idealism rather than serious science.” (page 289)
I’m deeply impressed that we – broadly speaking here – have come up with a clear and precise way to structure, communicate about, and use a concept which used to be so abstract and fuzzy as to be regarded as mystical.
I’m typing this before finishing the book, so I hope I’m not stepping on Coen’s toes, and of course I expect that he and/or many others who’ve read the book have had the same insight. But the big question for me is whether anybody else who is thinking about visual programming or end-user programming has come across the metaphor, and whether there’s any way to exploit it in that context to make a very difficult concept more accessible.
*Coen’s story is all about the details of how the flower parts are distinguished from each other by “hidden colors” – which is a brilliant and powerful metaphor he develops throughout the book to illuminate the self-referential role of proteins in the development of biological organisms. It’s pretty enlightening if you’re interested in emergence, self-organization, chaos/complexity theory, and that sort of thing.