Showing posts with label inheritance. Show all posts
Showing posts with label inheritance. Show all posts

Saturday, February 10, 2007

Multiple inheritance issue

It turns out I was wrong about baby class inheritance. In addition to the abstract baby class (,which is responsible for most of your problems!) babies inherit a few things from both you and your partner. It’s a classic case of multiple inheritance and all that jazz.
The most important feature of any MI system is conflict resolution. How does the inheritor decide which inheritee implementation of a common method to use? Predictably – it tends to use the worst possible configuration it stumbles upon. What does that translate to?
For example: Mom likes to keep it neat while I like to crumple paper before throwing it in the tin can. The resulting combination at breakfast time is David keeping his part of the table neat by crumpling his toast and eggs and throwing them in the direction of the tin can.
I guess we have a few bugs to iron out here…

Friday, February 03, 2006

Basic design flaws (part II)

Subtitled: Inheritance

Despite what you might have learned at sex class – your baby does not inherit from you. Babies inherit from an abstract baby class. The bad news is over 90% of class methods are abstract and need implementation. The other 10% need redesign.

As you may have noticed – the designer of the abstract baby class had no clue and surely had no experience in OOP. Case in point is the “eat (object food)” method. You might think that putting any object as food would do. Certainly there’s nothing in the method signature that suggests otherwise. You would be wrong! You see, babies need different kind of food objects at different stages in their development. You’d think the almighty class designer would consider other solutions to the problem, but nooo. It’s up to you to know how your baby works and what to feed it and when. Talk about encapsulation…

As previously stated, the baby does not inherit from you. You see, none of your class methods will work in a baby. You need to write them from scratch. The good news is none of your spouse methods are implemented. So she needs to program them too.

And guess who’s a better programmer!