Coupling Between Objects
From Maisqual Wiki
CBO relates to the notion that an object is coupled to another object if one of them acts on the other, i.e. methods of one use methods or instance variables of another. As stated earlier, since objects of the same class have the same properties, two classes are coupled when methods declared in one class use methods or instance variables defined by the other class.
- Excessive coupling between object classes is detrimental to modular design and prevents reuse. The more independent a class is, the easier it is to reuse it in another application.
- In order to improve modularity and promote encapsulation, inter-object class couples should be kept to a minimum. The larger the number of couples, the higher the sensitivity to changes in other parts of the design, and therefore maintenance is more difficult.
- A measure of coupling is useful to determine how complex the testing of various parts of a design are likely to be. The higher the inter-object class coupling, the more rigorous the testing needs to be.
- This coupling can occur through method calls, field accesses, inheritance, arguments, return types, and exceptions.
- Original paper from Chidamber and Kemerer : A Metrics Suite for Object Oriented Design
- Subramaniam et al. compared it to other metrics in some contexts: Empirical Study of CK metrics for object-oriented design complexity: Implications for software defects