Upload
nesma
View
68
Download
0
Embed Size (px)
DESCRIPTION
IWSM Presentation
Citation preview
On Automatically Collectable Metrics for Software
Maintainability Evaluation
Jan-Peter Ostberg
&
Stefan Wagner
Maintenance WorkerAssessment of
Maintenance Work
(metrics maintenance) OR(maintenance measure) AND
Software ORmaintainability
0
1
2
3
4
5
6
7
8
9
10
11
12
What defines a good measure?
Easy to understand…
…, but also accurate.
Easy to Use
Often mentioned metrics…
… but not practical ones.
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
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:
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?
Lines of Code
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:
We need better
ways to measure
our software!
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
giphy.com
Suggestion: Clone-Ration
„…every second unintentionalinconsistency between clones constitutes to a fault…”Juergens et al. „Do code clones matter?“
Suggestion: Bug-Patterns
• Bug-Detection-Toolsare getting reallygood.
• Low amount of findings impliesbettermaintainability
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
Conclusion• The blindfolded usage of maintenance metrics is problematic.• There are useful and accurate maintenance metrics. • The metrics should be collected automatically.
For more, please read our paper!
Thank you for your attention!