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:
- Inherit. A child organism inherits the genome (the class definition) from its parents. Mostly identical to the parents'.
- 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.
- 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.
- 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.