5 ms·
You can do the same thing with objects though. I have "utilities" which can be used with objects. Per your example, if object(wall) and object(chair) both shar
by shanebellone 4y ago
You can do the same thing with objects though.
I have "utilities" which can be used with objects. Per your example, if object(wall) and object(chair) both share the attribute(color) then they both can utilize function(paint). The only prerequisite would that they are paintable.
- thesz 4y agoWhat you describe there is use of interfaces and properties. These things are much easier to reason about and to compose than classes with inheritance. For example, it is easy to solve Expression Problem [1] with interfaces and properties and it is hard to solve it with only classes and inheritance. [1] https://en.wikipedia.org/wiki/Expression_problem https://en.wikipedia.org/wiki/Expression_problem
- shanebellone 4y ago"These things are much easier to reason about and to compose than classes with inheritance." Fair. Personally, that looks like an argument for objects rather than against. Do these concepts oppose or complement OOP? Is inheritance somehow a hidden requirement?
- menotyou 4y agoI did not say that it is not possible to do it. I said it is counterintuitive for me to express or model it in that way. And as you can see in the discussion arising, even this simple example is becoming a complex modelling problem in OOP.