Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality...

6
Metrics

Transcript of Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality...

Page 1: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Metrics

Page 2: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Basili’s work

• Basili et al., A Validation of Object-Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96

• Predictors of fault-prone classes?

• 8 medium sized information management systems

Page 3: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Metric

• CBO metric: coupling between object classes: a class is coupled to another one if it uses its member functions and/or instance variables. CBO = number of classes to which a given class is coupled.

Page 4: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Hypothesis

• H-CBO: Highly coupled classes are more fault-prone than weakly coupled classes.

Page 5: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Result

• Indeed, highly coupled classes are more fault-prone than weakly coupled classes.

– Corollary: Classes that follow the LoD are less coupled and are therefore less fault-prone.

Page 6: Metrics. Basili’s work Basili et al., A Validation of Object- Oriented Design Metrics As Quality Indicators, IEEE TSE Vol. 22, No. 10, Oct. 96 Predictors.

Demeter Motivation

• V. Basili 1996: classes with less coupling are less error prone.

• Demeter reduces the coupling in two stages: – Following the Law of Demeter using standard

object-oriented techniques eliminates the obviously bad coupling.

– Traversal strategies reduce the coupling further by coupling only with (distant) stable friends.