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!

No comments: