Carlos Pires
1 min readMar 13, 2019

--

OOP problems are not programming problems. They are philosophical problems because they are “category errors”.

Aristotle would be a lousy programmer. He would put fish, dolphins and shrimp inheriting from the same base class. That would be his fault, not OOP’s.

Hierarchies and Inheritance make sense but only for limited sets of structural characteristics which are actually (like, in reality) inherited. That is why the “powered device” is a terrible example, and also why OOP nowadays makes heavy use of trais and interfaces.

Modelling things based on “containment” can get you into trouble as much as any other hierarchical approach. The core of the problem is not hierarchy in itself, but the accidental coupling of things that should be decoupled.

That’s why I find the most useful strategy to be the “removal test” — when you are modelling something, just ask yourself “What will happen to the system if I remove this completely?”.

--

--

Carlos Pires
Carlos Pires

Written by Carlos Pires

Designer / Developer / Much more

No responses yet