LCOM: Lack of Cohesion in Methods
- Often poorly described
- Class Ck with n methods M1,…, Mn
- Ij is the set of instance variables used by Mj
Let class C have methods M1, M2, M3
I1 = { a, b, c, d, e }
I2 = { a, b, e}
I3 = { x, y, z }
P = { (I1, I3), (I2, I3) }
Q = { (I1, I2) }
LCOM = |P| - |Q|
= |{ (I1, I3), (I2, I3) }| - |{ (I1, I2) }|
= 2 - 1
= 1
LCOM1 = |P| - |Q|, if |P| > |Q|
LCOM1 = 0 otherwise
SI = [NOO * L] / Mtotal
MIF = ∑ni=1 Mi(Ci) / ∑ni=1 Ma(Ci)
CF = ∑i∑j is_client(Ci, Cj) / (TC2 - TC)
PF = Mo(Ci) / ∑ki=1 Mn(Ci) * DC(Ci)