|
|
|
|
|
by tigershark
3625 days ago
|
|
you were not speaking about interfaces, you were speaking about composition.
As I said composition and inheritance are two completely different concepts.
And I'm not making up the definitions, is a and has a are very well known concepts in computer science.
You can argue ad libitum, but this doesn't change the definition.
https://en.m.wikipedia.org/wiki/Has-a
https://en.m.wikipedia.org/wiki/Is-a |
|
> Also, maybe eliminate inheritance and force interfaces and composition instead.
Implementing an interface meets all the conditions of an is a relationship; no redefinition is necessary. [0] After all, interfaces are nothing more than abstract base classes with no method bodies to inherit. I haven't argued anywhere that composition defines an is a relationship, so I have no idea where you're pulling that from.
[0] https://en.m.wikipedia.org/wiki/Is-a#Java
EDIT: I really like this article you linked. It has all sorts of things that help me prove my point. For instance, the Rectangle example from the LSP section. If Rectangle were an interface:
It's trivial to implement concrete Rectangle and Square classes that don't violate any principles. Inheritance, on the other hand, is pretty much guaranteed to be broken as long as Rectangle is mutable, because Square cannot add additional constraints to Rectangle and still pretend to be a Rectangle in all use-cases.