Separate non-communicating behaviour

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(created page for riel's heuristic 2.10)
 
m
Line 13: Line 13:
 
*[[Interface segregation principle]]
 
*[[Interface segregation principle]]
 
*[[Extract Class]]
 
*[[Extract Class]]
 +
 +
[[Category:Riel's heuristics]]

Revision as of 04:10, 22 July 2009

Spin off non-related information into another class (i.e., non-communicating behavior). --Riel's Heuristic 2.10, Arthur Riel 1996

This heuristic tells developers to look for classes where some of the methods operate on one set of data members and the rest of the methods operate on different data members. This non-communicating behavior indicates that two classes that should be separated have been combined into one.

In the extreme case, half of the methods in a class may operate on half of the data members and the other half of the methods may operate on the other half of the data members. In this case, the two sets of data and behavior are clearly not related since there is no communication between them.

If such non-communicating behavior is found, it should be separated into two separate classes.

See also

Personal tools