iwsm2014 on automatically collectable metrics for software maintainability evaluation (jan-peter...

21
On Automatically Collectable Metrics for Software Maintainability Evaluation Jan-Peter Ostberg & Stefan Wagner

Upload: nesma

Post on 04-Jul-2015

68 views

Category:

Software


0 download

DESCRIPTION

IWSM Presentation

TRANSCRIPT

Page 1: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

On Automatically Collectable Metrics for Software

Maintainability Evaluation

Jan-Peter Ostberg

&

Stefan Wagner

Page 2: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Maintenance WorkerAssessment of

Maintenance Work

Page 3: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

(metrics maintenance) OR(maintenance measure) AND

Software ORmaintainability

Page 4: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

0

1

2

3

4

5

6

7

8

9

10

11

12

Page 5: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

What defines a good measure?

Page 6: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Easy to understand…

…, but also accurate.

Page 7: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Easy to Use

Page 8: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Often mentioned metrics…

… but not practical ones.

Page 9: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

McCabe

if( P1 ){

if( P2 ){

expression2;

}else{

expression3;

}else{

expression1;}

if((P1 && P2 && !P3)||(P1 && P3 && P4)){

if((P5 && P6 && P7)||(!P5 && !P7)){

expression2;

}else{

expression3;

}else{

expression1;}

Code on bottom is clearly more complex.

McCabe for both = 3

Page 10: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Halstead Software Science

Program Volume: V = N x log2 h

2

21

2 h

h ND

Implementation time:

18

VDT

18 elementary decisions per second

Difficulty of a Program:

Page 11: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Lines of Code

public String tellMeEqual (int a, int b){

String result = „undefined“;

if (a > b){

result = „a is larger“;

} else {

if(a == b) {

result = „a is equal“;

} else {

result = „b is larger“;

}

}

return result;

}

What is the LoC value here?

13?

5?

Page 12: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Lines of Code

Page 13: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Maintainability Index

)46.2sin(50()ln(2.16

23.0)ln(2.5171

centageCommentPerLoC

McCabelumeHalsteadVo

))171

100)log(2.1623.0)log(2.5171(,0( LoCMcCabelumeHalsteadVoMAX

Simplified Version:

Page 14: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

We need better

ways to measure

our software!

Page 15: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Suggestion: Nesting Depthif(P==1){

expression1;

}else{

if(P==2){

expression2;

}else{

if(P==3){

expression3;}

}

}Switch(P){

case 1:

expression1;

break;

case 2:

expression2;

break;

case 3:

expression3;

break;}

Nesting depth = 3

Nesting depth = 1

Page 16: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

giphy.com

Suggestion: Clone-Ration

„…every second unintentionalinconsistency between clones constitutes to a fault…”Juergens et al. „Do code clones matter?“

Page 17: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Suggestion: Bug-Patterns

• Bug-Detection-Toolsare getting reallygood.

• Low amount of findings impliesbettermaintainability

Page 18: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Suggestion: Test Results and Coverage

http://testing.gobanana.co.uk

• More tests + highcoverage implies code istest-friendly

• Ignored test results area hint for notunderstood code parts

• Tests encourage themaintenance of code

Page 19: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Conclusion• The blindfolded usage of maintenance metrics is problematic.• There are useful and accurate maintenance metrics. • The metrics should be collected automatically.

Page 20: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

For more, please read our paper!

Page 21: Iwsm2014   on automatically collectable metrics for software maintainability evaluation (jan-peter ostberg & stefan wagner)

Thank you for your attention!