Separate methods that do not communicate

From CSSEMediaWiki
Jump to: navigation, search

If there are different ways to view different objects of the same 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 a single class can be viewed as representing multiple concepts then it is likely that this class should be split. This also conforms to the single responsibility principle.

A good way to tell us whether a class needs to be split is by checking whether there are methods in a class which do not communicate. Non-communicating methods is a good indication that there are multiple concerns within one class, and therefore it needs to be split.

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

See also

Personal tools