Nil or export coupling only

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(See also)
Line 1: Line 1:
Riel's Heuristic #2.7
+
:''Classes should only exhibit nil or export coupling with other classes, i.e. a class should only use operations in the public interface of another class or have nothing to do with that class'' Riel's Heuristic 2.7, [[Arthur Riel 1996]]
  
Classes should have only nil or export coupling with other classes. Classes should only depend on the public methods of another class or nothing at all. Other forms of coupling give away implementation details of a class, which is bad for maintenance when implementations need to be changed.
+
Classes should only depend on the public methods of another class or nothing at all. Other forms of coupling give away implementation details of a class, which is bad for maintenance when implementations need to be changed.
 
+
Riel also states that class cohesion ensures that all elements off a class are related.
+
  
 +
Riel also states that class cohesion ensures that all elements of a class are related.
  
 
== See also ==
 
== See also ==
Line 10: Line 9:
 
* [[Program to the interface not the implementation]]
 
* [[Program to the interface not the implementation]]
 
* [[Design by contract]]
 
* [[Design by contract]]
 +
 +
[[Category:Riel's heuristics]]

Revision as of 23:40, 20 July 2009

Classes should only exhibit nil or export coupling with other classes, i.e. a class should only use operations in the public interface of another class or have nothing to do with that class Riel's Heuristic 2.7, Arthur Riel 1996

Classes should only depend on the public methods of another class or nothing at all. Other forms of coupling give away implementation details of a class, which is bad for maintenance when implementations need to be changed.

Riel also states that class cohesion ensures that all elements of a class are related.

See also

Personal tools