When methods of a class excessively access operations of one or a few other classes, it is said that the class is intensively coupled with those one or few provider classes.
Impact
- Understanding the
relation between the client method & the classes providing services becomes difficult.
Characteristics
- Methods of affected class call too many methods. These methods are called from only a few other classes.
- Calling Methods
have a non-trivial level of nested conditionals (nested IF-ELSE statements).
Example(s)
- The method formatParagraph in TextArea accesses 9 different methods from JEditBuffer.
Guidelines
- Moving intensively coupled operations to a single new operation.
- Split the method affected by Intensive Coupling into one or more methods based on the classes with which it is interacting.
- Reduce the number of outgoing interactions of this method with methods belonging to other classes by splitting the method and logically moving it to other classes.