9. 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
10. Halstead Software Science
Program Volume: V = N x log2 h
h N
1 2
2 h
2
D
Implementation time:
D V
18
T
18
elementary
decisions per
second
Difficulty of a Program:
11. Lines of Code
What is the LoC value here?
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;
}
13?
5?
16. giphy.com
Suggestion: Clone-Ration
„…every second
unintentional
inconsistency between
clones constitutes to a
fault…”
Juergens et al. „Do code clones matter?“
17. Suggestion: Bug-Patterns
• Bug-Detection-Tools
are getting really
good.
• Low amount of
findings implies
better
maintainability
18. Suggestion: Test Results and Coverage
http://testing.gobanana.co.uk
• More tests + high
coverage implies code is
test-friendly
• Ignored test results are
a hint for not
understood code parts
• Tests encourage the
maintenance of code
19. Conclusion
• The blindfolded usage of maintenance metrics is problematic.
• There are useful and accurate maintenance metrics.
• The metrics should be collected automatically.
Um Software zu vermessen brauchen wir Metriken
Das ist keine neue Erkenntnis, daher haben wir gesucht.
Was könnten Prctioniers / Students finden?
First 40 hits
Left us with 16 papers
Nennungen
Überhaupt not wendig?
Should be easy to use, should be expressive
Help you!
and as people in IT don‘t like to do things twice, best automatical
Edges – nodes +2
What is a programms Volume? Can anybody imagin that?
Pro Gamers were measured to make 400 actions per minute -> 6.7 actions per second!!
N = Programm lemgth (total number of Operators + total number of Operands)
eta = Programms vocabulary (distinct # operators + distinct # operands)
A unstructered pice of code can have less LoC, but be less more maintaiable, then a good structred code with more LoC.
Problematisch unreflektiert zu übernehmen
Es gibt aber gute
Bewustsein für sinnvolle metricen
Automatisch erfassbar, das sonst ehr keiner