top | item 45945612

(no title)

elviejo | 3 months 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.

discuss

order

wild_egg|3 months ago

There's some OO design fallacy here but not sure what to call it.

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.

gsinclair|3 months ago

My programs are not full of engines and cars and planes and boats and aquaplanes.

These metaphors used to teach OOP back in the day seemed appealing but never proved their worth in actual software design and implementation.