Files
VV-ISTIC-TP2/exercises/tcc-vs-lcc.md
2025-11-28 08:08:14 +01:00

43 lines
1005 B
Markdown

# 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](https://oscarlvp.github.io/vandv-classes/#cohesion-graph).
## 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;
}
```
```mermaid
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