Separate methods that do not communicate

From CSSEMediaWiki
Revision as of 08:14, 6 October 2008 by Elliot Fisher (Talk | contribs)
Jump to: navigation, search

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