Skip navigation.
Strategic Software Research

Software as a Darwinian Act

The point of this article is to enjoin software developers everywhere:

Write immortal code

This seemingly simple goal unpacks to explain every guideline and rule ever invented to legislate better software. At the same time, it is very easy to apply: just ask yourself, "What can I do to help this chunk of code I'm writing to outlive me?"

The trick is to adopt a Darwinian point of view: the ultimate goal of every organism is to ensure the immortality of its genes. In the biological world, the only mechanism available is to provide the best possible opportunity for offspring to survive and propagate. The measure of success is the differential advantage in the reproduction rate; the competitive dynamics favours the successful over the course of time and thus in time works to the betterment of the species (more of the species becomes more successful)

The introduction of 'cultural' information - that is, information which is not encoded via genes, but rather transmitted among individual organisms and which is capable of surviving individuals - expands the dynamics of evolution. The wide distribution of "good" cultural information (e.g., wash your hands before eating) also works to improve the relative success of the species. We therefore can consider a species as being the entire collection of biological and cultural information associated with it, moving forward through time.

Now, our cultural artifacts, including songs, games, software, documentation, rants from the pulpit or blog, new hairstyles or ways of making furniture, all compete in the Darwinian jungle of cultural as our biological offspring competes in the Darwinian jungle of nature. Welcome to planet Darwin. Everyone's a player.

OK, so tell me again about immortality? Right... think of your code as a little snippet with a life of its own. What snippet of code is the most successful, ever, so far? We could measure this concretely by associating the number of CPU cycles it (over all of its copies) has consumed. It's probably some little timing loop in a widely deployed operating system. It's critical (hence always required); it's useful (that's why it's there in the first place); it's efficient (else it would have been re-written to be more efficient). Interesting that the measure of success (CPU cycles) is also the factor being minimized in finding the optimally successful snippet for the job.