C.W.K.
Stream
Lesson 03 of 05 · published

Evolution is inheritance with override — the scariest refactor in history

~30 min · evolution, inheritance, selection

Level 0Curious Beginner
0 XP0/43 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Evolution, but technically

Most people learn evolution as survival of the fittest — vaguely Darwinian, vaguely competitive. The OO view is more precise. Evolution is inheritance with override, sorted by selection pressure.

Here's how it actually works:

  1. Inherit. A child organism inherits the genome (the class definition) from its parents. Mostly identical to the parents'.
  2. Mutate (override). A few random changes happen during copying — point mutations, insertions, deletions, duplications. Each is a tiny override of the inherited code. Most are neutral, some are harmful, a few are beneficial.
  3. Select. The organism either survives long enough to reproduce or doesn't. If the override helped survival/reproduction, that override gets carried into the next generation. If it hurt, it doesn't.
  4. Repeat. Over millions of generations, beneficial overrides accumulate. The class definition drifts. Eventually the descendants are different enough to call a new species.

This is exactly inheritance with override in OO programming, except the override survival is judged by reality, not by a unit test. Selection pressure is the harshest QA in the universe.

The shared base classes are still there

You inherit from a long chain of base classes. Vertebrate. Mammal. Primate. Hominid. Homo sapiens. Each ancestor's overrides are still in your code base, mostly. You have leftover *vestigial* features from base classes that no longer serve their original purpose:

  • Goosebumps — useful when our furry ancestors needed to puff up. Inherited override never deleted.
  • Wisdom teeth — molars sized for diets we no longer eat.
  • The appendix — inherited from herbivorous ancestors.
  • Tailbone — the leftover anchor point from when we had tails.

These are the commented-out methods of the species class. Still present in the source, no longer called.

Why some species change fast and others don't

Selection pressure determines refactoring speed. Bacteria mutate fast and have huge populations, so they refactor quickly (which is why antibiotic resistance evolves in months). Whales reproduce slowly with small populations, so their class definitions drift slowly. The pattern is universal — more reproductions per unit time, more selection pressure, faster refactor.

Evolution isn't progress toward something. It's just inherit-mutate-select on a loop, for billions of years. The shapes that come out are the shapes that survive that loop. Every species alive today, including ours, is a working override of an unbroken inheritance chain back to the first cell.

External links

Exercise

Find one vestigial feature in your own body (goosebumps when cold, the bump where your tailbone is, the wisdom-teeth feeling). Recognize that you're carrying an override from an ancestor whose context has long passed. The diff history is in your body, right now.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.