I've been busy with LCOM and the plugin Metrics in eclipse. In which I have to calculate manually the Lack of Cohesion of a class and compare it with the result of Metrics. But this plugin returns a LCOM of 1/3. How can LCOM be a rational number?
Because what I've been told is that
P := number of dissimilar method pairs
and
Q := number of similar method pairs.
And
if P>Q
then LCOM = P - Q
otherwise LCOM = 0
Is this equation correct? or is my plugin malfunctioning?
There are several LCOM metrics which can be used so I can assume that you are not referring to the one used by that plugin. For example, these are the metrics used by ndepend and both are rational numbers:
Where:
(Source: ndepend.com)