December 2001
Intermediate to advanced
360 pages
9h 6m
English
When inheritance was first introduced into some other languages, it caused problems as users went too far, creating deep and overly complex inheritance trees. Inheritance is powerful and useful, but should not be overdone. I remember working with a developer. He spent an entire day working on the design of objects and finally said, “I can't figure out where to use polymorphism.” My suggestion was that if he couldn't find where to use it, maybe he didn't need to.
There are actually three ways to build an object model:
Encapsulation— If you want to use functionality from an object, but not really look like the object or override its functionality, don't inherit; instead, encapsulate an instance of the ...