Containment implies uses
From CSSEMediaWiki
(Difference between revisions)
(New page: :''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 ...) |
|||
Line 1: | Line 1: | ||
:''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 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 | + | 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. |
==Related to== | ==Related to== |
Latest revision as of 23:30, 12 October 2009
- 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.