-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Sonar Code Quality Testing Essentials
By :

In object-oriented programming (OOP), cohesion and coupling are two fundamental concepts. The basic principle is to have classes with loose coupling and high cohesion. Loose coupling enables modularized packages that do not heavily rely on each other, while high cohesion provides tight and solid components with clearly defined responsibilities. High coupling means that a class relies on many other classes, while low cohesion signals for a class could be split into separate ones, offering fine-grained functionality.
Afferent (incoming) coupling is the total number of classes that depend on a given class. In Sonar, you can view afferent coupling within the Sonar source viewer under the Dependencies tab. For example, the afferent coupling for the class ReflectionToStringBuilder
in the Apache commons-lang
project equals to 4. Type the class name in the top-right search box from Sonar to find the class and open it in the source viewer. Then, click on...
Change the font size
Change margin width
Change background colour