Digital Marketing

Java Code Quality Matrices

MatricesDefinition and Explanation
Number of ClassesFor same project, more classes mean better abstracted. But try to keep this number down if applicable.
Lines of Code (LOC)For same project, fewer lines of code mean better design and less maintenance.
Number of Children (NOC)Number of immediate sub-classes of a class. Try to keep it down to avoid classes become too complex.
Response for Class (RFC)Number of all methods implemented within the class plus the number of methods accessible to an object of this class due to implementation. The higher the RFC, the more difficult to make changes. Try to keep it lower.
Depth of Inheritance Tree (DIT)Maximum inheritance path from the class to the root class. Try to keep it under 5.
Weighted Methods Per Class (WMC)Average number of methods defined in class. Try to keep it under 14.
Coupling between Object Classes (CBO)Number of classes to which a class is coupled. Try to keep it under 14.
Lack of Cohesion of Methods (LCOM4)It measures the number of ‘connected components’ in a class. A low value suggests that the code is simpler and reusable. A high value suggests that the class should be broken up into smaller classes. Try to break down the class if this matrix become higher than 2.
Cyclomatic Complexity (CC)Measure of different executable paths through a module. Higher number of executable paths means more test. Thus more difficult to understand and change. Try to keep this value under 10.
Distance (D)Distance from the idealized line of A + I = 1. The smaller the distance of your software from the idealized line, the better you are.
Abstractness (A) = Na/Nc.
Na = Number of abstract classes, and
Nc = Number of concrete classes
Instability (I) = Ce / (Ce + Ca).
Afferent Couplings(Ca) = The number of other packages that depend upon classes within the package.
Efferent Couplings(Ce) = The number of other packages that the classes in the package depend upon.


Popular posts from this blog

How to fix Google Apps Script: Script function not found: doGet

Selenium supports Java

Creating sort index in MySQL