The CBO metric is approximately defined as the number
of couples with other classes (where calling a method or
using instance variable from another class constitutes
coupling). The more independent a class is, the easier it is to
reuse it in another application. To improve modularity and
promote encapsulation inter class coupling should be small.
The larger the number of couples, the higher is the sensitivity
to changes in other parts of the design and therefore
maintenance is more difficult. CBO metric is useful to
determine how complex the testing of various parts of a
design is likely to be. The higher the CBO is, the more
rigorous the testing needs to be. CBO depends on the manner
in which methods are designed and not on the functionality
of the class.
The LCOM metric is defined as a count of the method
pairs that do not have common instance variable minus the
count of method pairs that do. The larger the number of
similar methods, the more cohesive is the class. If none of
the methods of a class display any instance behaviour, i.e. do
not use any instance variables, they have no similarity and
the LCOM for the class will be zero. Cohesiveness of
methods within a class is desirable, since it promotes
encapsulation. Lack of cohesion implies classes should be
probably split into two or more subclasses. Any measure of
disparity of methods helps identify flaws in the design of
classes. Low cohesion increases complexity, thereby
increasing the likelihood of errors during the development
process.