Analizo::Metric::LackOfCohesionOfMethods - Lack of Cohesion of Methods (LCOM4) metric
The metric calculation is based on the following article and calculates the cohesion of the class.
Article: Comparison of Various Lacks of Cohesion Metrics by Taranjeet Kaur and Rupinder Kaur.
See the paragraphs about Lack of Cohesion of Methods LCOM4 in the article:
LCOM3 varies in range between [0, 1]. LCOM3 indicates high cohesion and it is also a well defined class, it show simplicity of class and high reusability of class. A highly cohesive class provides high degree of encapsulation. LCOM3 formula is
[0, 1]
M: number of methods in a class A: number of variables in a class m.A: number of methods that access a variable Sum(m.A): number of methods over attributes a: variabes that shared may be or not LCOM3=(m - Sum(mA) / a) / m - 1
In other words also say that consider connected components of graph or also say that if we consider undirected graph G where vertices are methods of a class and edge between vertices if corresponding methods at least share one instance variable.
G
LCOM4 is like LCOM3 where graph G additionally has an edge between vertices representing methods Mi and Mj if Mi invokes Mj. In other words also say that, it measure number of components in a class. A connected component is a set of related methods.
Mi
Mj
To install Analizo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Analizo
CPAN shell
perl -MCPAN -e shell install Analizo
For more information on module installation, please visit the detailed CPAN module installation guide.