1005 B
1005 B
TCC vs LCC
Explain under which circumstances Tight Class Cohesion (TCC) and Loose Class Cohesion (LCC) metrics produce the same value for a given Java class. Build an example of such as class and include the code below or find one example in an open-source project from Github and include the link to the class below. Could LCC be lower than TCC for any given class? Explain.
A refresher on TCC and LCC is available in the course notes.
Answer
Pour que TCC et LCC soient égaux, il faut que toutes les paires soient directes.
Ainsi par exemple :
A(){
x;
y;
}
B(){
x;
y;
}
C(){
y;
}
D(){
z;
}
E(){
z;
}
flowchart
A --"x,y"--- B
B --"y"--- C
C --"y"--- A
D --"z"--- E
Ici, on a donc un total de 10 paires possibles, 4 liaisons directes, et aucun pair uniquement possible par une liaison indirecte. TCC = 4/10 LCC = 4/10