|
|
|
|
|
by elviejo
213 days ago
|
|
In Eiffel we have multiple inheritance.
It's such a powerful tool.
And a natural way to model the world.
For example if you think of your typical OOP book
You have
Vehicles with engines
* cars that move on roads
* planes that move on air
* and boats that move on water. But then comes an aqua-plane and it breaks your inheritance tree! But with multiple inheritance is the most natural thing to have a plane that is also a boat and a car. In Eiffel we favor the appropriate tool that better represents the world. |
|
The reason the aqua-plane broke the inheritance tree is because the modeling is being done backwards.
Objects should be defined by behaviour first and only incidentally contain whatever state is required to support that behaviour.
A well designed object is much more similar to a closure than it is to a data structure.