Component Interfaces
Interaction with objects requires some stimulus to invoke their behavior. In an inheritance hierarchy, the interaction is similar as you move down the hierarchy. For example, if there was an electrical appliance hierarchy, it could have child objects of clock, radio, and microwave. Each of these objects has the behavior of running on electrical power. Therefore, this behavior could be invoked by a power connection.
The run-through-power-connection behavior is expected behavior that is relied upon to accomplish the task we need done in the most efficient manner. If one of these objects operated in another way, it would lead the operator to be confused or believe something was wrong. Common behavior helps tasks be performed ...
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