Containment implies uses
From CSSEMediaWiki
Revision as of 23:28, 12 October 2009 by Michal Connole (Talk | contribs)
- If a class contains objects of another class, then the containing class should be sending messages to the contained objects, that is, the containment relationship should always imply a uses relationship. --Riel's Heuristic 4.5, Arthur Riel 1996
If a class contains an object, but does not use it, the object is useless. In order for this object to be useful to the program, the enclosing class must have an accessor for the object which defeats the information hiding principle.