[dba-Tech] OOP is upside-down

Arthur Fuller fuller.artful at gmail.com
Sun Jul 12 07:50:07 CDT 2020

OOP pretends to model itself  on the real world, but in fact does the
opposite -- it encourages you to be God-like. Start with a class called
Mammal, define some basic properties and methods, then inherit some
species (dog, cat, whale).  Biology doesn't work like that. It begins with
the individual species and then discovers a common parent species, and then
another parent.

What OOP needs is a way to model ancestry bottom-up. I imagine a tree-like
UI akin to the Windows Explorer, but with a new capability. Imagine that
you define classes called Giraffe, Chimp and Whale. Then it dawns upon you
that all of them share several characteristics; so then you create a new
class called Mammal, collect the Giraffe, Chimp and Whale, and drag them
into the Inheritance tree. All characteristics shared by all of them
migrate to the ancestor class. The class itself contains a method called
Speak (for the Whale, it's Click, Click, for the Chimp it's "Ehhhh", and so
on). collect those common characteristics, then drag and drop them (in this
case, the Speak method) into the ancestor class.

That's how biology, chemistry and physics work: bottom-up, not top-down.
Admittedly, prepared to what I'm suggesting might run into conflicts such
as naming. You might have named the Whale method Click rather than Speak,
and the dog method Bark rather than Speak. Certainly that is a problem that
my proposed Drag and Drop method cannot resolve easily. But nevertheless, I
am no prepared to abandon this notion. instead, I shall give it more
thought, and imagine a tree-lik UI that gathers the obvious commonalities
and moves the data and methods up to the ancestor, leaving only the
differences (both data and methods) in the descendants. This allows you to
realize that there is a common method called Speak, but you named it
differently in the previous classes: in the Whale you named it ClickClick,
in the Cat you named it Meow, in the dog you named it Bark. You're a
mortal; we all make mistakes, and fail to recognize common characteristics
until way after the fact of creation.
What OOP needs is a way to address, and maybe even solve, this problem.


More information about the dba-Tech mailing list