12.3 First Design
When designing a project like our graphics module, it is a good idea to begin by making a list of the kinds of objects involved and the relationships among those objects. As we make the list of objects, we will try to identify two important kinds of relationships among the objects: IS-A and HAS-A.
The IS-A relationship describes two objects, one of which is a more specific instance of the other. For example, a square is a more specific instance of a rectangle, and a circle is a more specific instance of an ellipse. As we identify these IS-A relationships, we also look for functionality that each of the instances has in common. Classes with IS-A relationships are ideal for a design using inheritance.
A HAS-A relationship describes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access