One of the most profound insights I have learnt about OO is that class design — the shaping of classes & types — is best informed by what processing needs to do, rather than the ‘kind’ of entities it goes between.
What we are talking about here is behavior, rather than trying to categorize entities at rest. Program code only acts by being executed; classes & interfaces (types) are a mechanism to despatch that execution to specific methods. This shows that OO types are really about behavior, rather than any other arbitrary notions of classification.
But shouldn’t inheritance follow entities & their properties?
At this point, we’ll address a common interjection — what about bean-style entities, and inheritance of their properties? Surely these aren’t behavior! Continue reading