next up previous
Next: Design Guidelines and Code Up: Cohesion Previous: Improvement of LCOM (


Tight Class Cohesion ($ TCC$ )

Works with all instances of a common meta-model, regardless of whether they were produced with the Java or the UML front-end. The respective extends (Java) or generalization (UML) relations expressing the inheritance between two classes are mapped onto relations of type inheritance in the common meta-model (and the $ TCC$specific view).
Handle
$ TCC$
Description
The Tight Class Cohesion metric measures the cohesion between the public methods of a class. That is the relative number of directly connected public methods in the class. Classes having a low cohesion indicate errors in the design.
Scope
Class
View
$ {V}^{TCC} = ({G}^{TCC}, {R}^{TCC})$
  • Grammar $ {G}^{TCC} = (\{\textrm{class}^{TCC}, \textrm{method}^{TCC}, \textrm{field}^{TCC}\}, \emptyset, \\ \textrm{class}^{TCC})$
  • Relations $ {R}^{TCC}: \{\textrm{methodof}^{TCC} : \textrm{method}^{TCC} \times \textrm{cl... ...C},\\ \textrm{uses}^{TCC} : \textrm{method}^{TCC} \times \textrm{field}^{TCC}\}$
  • Mapping $ \alpha^{TCC}$:
    $\displaystyle \alpha^{TCC}(\textrm{Class})$ $\displaystyle \mapsto$ $\displaystyle \textrm{class}^{TCC}$  
    $\displaystyle \alpha^{TCC}(\textrm{Field})$ $\displaystyle \mapsto$ $\displaystyle \textrm{field}^{TCC}$  
    $\displaystyle \alpha^{TCC}(\textrm{Method})$ $\displaystyle \mapsto$ $\displaystyle \textrm{method}^{TCC}$  
    $\displaystyle \alpha^{TCC}(\textrm{IsFieldOf})$ $\displaystyle \mapsto$ $\displaystyle \textrm{fieldof}^{TCC}$  
    $\displaystyle \alpha^{TCC}(\textrm{IsMethodOf})$ $\displaystyle \mapsto$ $\displaystyle \textrm{methodof}^{TCC}$  
    $\displaystyle \alpha^{TCC}(\textrm{Accessess})$ $\displaystyle \mapsto$ $\displaystyle \textrm{uses}^{TCC}$  

Definition
The Tight Class Cohesion (TCC) measures the ratio between the actual number of visible directly connected methods in a class $ NDC(C)$divided by the number of maximal possible number of connections between the visible methods of a class $ NP(C)$. Two visible methods are directly connected, if they are accessing the same instance variables of the class. $ n$is the number of visible methods leading to:
$\displaystyle M(c)$ $\displaystyle =$ $\displaystyle pred(c, \textrm{methodof}^{TCC})$  
    $\displaystyle \textit{-\hspace{1pt}- set of methods contained in c}$  
$\displaystyle M^{public}(c)$ $\displaystyle =$ $\displaystyle \{m_{i} \vert m_{i}.\textrm{visibility} = \textrm{public} \wedge m_{i} \in M(c)\}$  
    $\displaystyle \textit{-\hspace{1pt}- set of methods contained in c}$  
    $\displaystyle \textit{-\hspace{1pt}- having public visibility}$  
$\displaystyle I(c,m)$ $\displaystyle =$ $\displaystyle succ(m, \textrm{uses}^{TCC}) \cap F(c)$  
    $\displaystyle \textit{-\hspace{1pt}- set of fields contained in c and used by m}$  
$\displaystyle NDC(c)$ $\displaystyle =$ $\displaystyle \{(m_{i},m_{j}) \vert I(c,m_{i}) \cap I(c,m_{j}) \neq \emptyset \wedge m_{i},m_{j} \in M(c)\}$  
    $\displaystyle \textit{-\hspace{1pt}- set of public method pairs contained in c}$  
    $\displaystyle \textit{-\hspace{1pt}- accessing the same field}$  
$\displaystyle NP(c)$ $\displaystyle =$ $\displaystyle \frac{\left\vert M^{public}(c)\right\vert(\left\vert M^{public}(c)\right\vert-1)}{2}$  
$\displaystyle TCC(c)$ $\displaystyle =$ $\displaystyle \frac{NDC(c)}{NP(c)}$  

Scale
Ratio
Domain
Rational $ \in 0.0..1.0$.
Highly Related Software Quality Properties
 
Reliability 2.2
is positively influenced by cohesion.
Maturity 2.2.1:
Parts of a system showing a high cohesion may be highly directly related to maturity, since a mature system ought to have high cohesion values.

Maturity increases with increasing TCC.

Re-Usability 2.4
is negatively influenced by coupling.
Understandability for Reuse 2.4.1:
Parts of a system showing a high cohesion may be highly directly related to understandability for reuse, since they implement only one concept.

Understandability increases with increasing TCC.

Attractiveness 2.4.4:
Parts of a system showing a high cohesion may be highly directly related to attractiveness for reuse, since they implement only one concept.

Attractiveness increases with increasing TCC.

Maintainability 2.6
increases with increasing TCC.
Analyzability 2.6.1:
Parts of a system showing a high cohesion may be highly directly related to analyzability, since they implement only one concept.

Analyzability increases with increasing TCC.

Changeability 2.6.2:
Parts of a system showing a high cohesion may be highly directly related to changeability, since they implement only one concept.

Changeability increases with increasing TCC.

Stability 2.6.3:
Parts of a system showing a high cohesion may be highly directly related to stability, since they implement only one concept.

Stability increases with increasing TCC.

Testability 2.6.4:
Parts of a system showing a high cohesion may be highly directly related to testability, since they implement only one concept.

Testability increases with increasing TCC.

Portability 2.7
increases with increasing TCC.
Adaptability 2.7.1:
Parts of a system showing a high cohesion may be highly directly related to adaptability, since they implement only one concept.

Adaptability increases with increasing TCC.

Related Software Quality Properties
 
Re-Usability 2.4
might decrease with increasing TCC.
Learnability for Reuse 2.4.2:
Parts of a system showing a high cohesion may be highly directly related to learnability, since they implement only one concept.

Learnability might decrease with increasing TCC.

Operability for Reuse - Programmability 2.4.3:
Parts of a system showing a high cohesion may be highly directly related to programmability, since they implement only one concept.

Programmability might decrease with increasing TCC.

Efficiency 2.5
might decrease with increasing TCC.
Time Behavior 2.5.1:
Parts of a system showing a high cohesion may be directly related to time behavior, since they implement only one concept, and do not do any unrelated time consuming tasks.

Time behavior might get worse with increasing TCC.

Resource Utilization 2.5.2:
Parts of a system showing a high cohesion may be directly related to resource utilization, since they implement only one concept, and do not do any unrelated resource utilization.

Resource utilization might get worse with increasing TCC.

Portability 2.7
increases with increasing TCC.
Replaceablity 2.7.4:
Parts of a system showing a high cohesion may be directly related to replaceability, since they implement only one concept.

Replaceablity might increases with increasing TCC.

References
 
  • TCC is extensively discussed and evaluated in [3,2,19],
  • TCC is implemented in the VizzAnalyzer Metrics Suite.
Since
1.0

next up previous
Next: Design Guidelines and Code Up: Cohesion Previous: Improvement of LCOM (
Copyright © 2008-2009, ARiSA AB. Phone: +46-(0)470 70 8495 Email: info@arisa.se Valid CSS! Valid XHTML 1.0 Transitional