Separate methods that do not communicate

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: If there are different ways to view different objects in a class, then it is a good signal that such a class needs to be split. In a good design, a class should only represent a single typ...)
 
Line 2: Line 2:
  
 
A good way to tell us whether our design of a class is need to be split is by checking whether there are methods in a class which do not communicate. No-communicating method is a good indication of separate concerns the particular class is taking responsible for. Then as a result, it needs to be split.
 
A good way to tell us whether our design of a class is need to be split is by checking whether there are methods in a class which do not communicate. No-communicating method is a good indication of separate concerns the particular class is taking responsible for. Then as a result, it needs to be split.
 +
 +
Riel's Heuristic [[Beware of non-communicating methods]] is derived from this.
 +
 +
== See also ==
 +
* [[Design maxims]]
 +
* [[Johnson and Foote 1988]]

Revision as of 08:14, 6 October 2008

If there are different ways to view different objects in a class, then it is a good signal that such a class needs to be split. In a good design, a class should only represent a single type of object entity. If there is different type of entities can be seen from the class than more specialized subclass is needed. This also conforms to the single responsibility principle.

A good way to tell us whether our design of a class is need to be split is by checking whether there are methods in a class which do not communicate. No-communicating method is a good indication of separate concerns the particular class is taking responsible for. Then as a result, it needs to be split.

Riel's Heuristic Beware of non-communicating methods is derived from this.

See also

Personal tools