![Page 1: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/1.jpg)
Software Metrics***
state of the art, weak points and possible
improvementsGordana Rakić, Zoran BudimacDepartment of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad
Melinda TóthEotvos Lorand University Budapest
![Page 2: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/2.jpg)
Contents
Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work
![Page 3: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/3.jpg)
Abstract
By targetProcess
Product
Resources
By availabilityInternal
External
By measurement objectSizeComplexityStructureArchitecture
By applicabilitySpecificationDesignSource code…
(Some of) Software metrics classifications
![Page 4: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/4.jpg)
Abstract Code complexity is measured by “old” metrics Inconsistency between the tools
[Novak and Rakic, 2011][Lincke et al. 2008]
Metrics algorithm are sometimes adapted during the implementation according to Programming language Programming paradigm Programming style …
![Page 5: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/5.jpg)
Question
Could some of these changes be generalized by introducing new metrics?
![Page 6: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/6.jpg)
Contents
Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work
![Page 7: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/7.jpg)
Software quality
Attributes of Product Quality (not only the software product) user point of view
functionality usability reliability efficiency portability
producer point of view maintainability
![Page 8: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/8.jpg)
Maintainability ISO 9126: maintainability of software product expresses
easiness of making changes during the product life cycle
is formally divided into analyzability, changeability, stability, and testability.
strongly depends on readability and clarity of the source code.
source code complexity Sometimes including
code size and data organization and usage.
![Page 9: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/9.jpg)
Contents
Abstract Introduction State of the Art Motivation Recursion Aware Complexity Discussion Conclusion Future Work
![Page 10: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/10.jpg)
State of the Art
Complexity and size metrics LOC Halstead Cyclomatic Complexity ... Derived metrics
![Page 11: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/11.jpg)
Cyclomatic Complexity
Expresses number of linearly independent paths through the program
Calculates the value based on number of control flows in the program
[McCabe, 1976]
![Page 12: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/12.jpg)
Cyclomatic Complexity
Can underestimate or overestimate complexity [Vinju and Godfry, 2012]
Derived metrics and modifications of CC: for OO languages
WMC
[Chidamber and Kemerer, 1993] for functional languages
number of branches of recursion
[Király and Kitlei, 2011] CC calculated on the graph built by in-lining the function
...
![Page 13: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/13.jpg)
QuestionHow RECURSION affect
complexity and maintainability?
How to measure it?
![Page 14: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/14.jpg)
Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work
![Page 15: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/15.jpg)
Motivation Trends
Multilingual projects Multi-paradigm languages … Tending to simplicity in programming we go
from introducing recursion to increase maintainability to long chain of (recursive) calls which decreases
maintainability
![Page 16: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/16.jpg)
Motivation
Control Flow Graph (CFG) One control flow graph represents one
function/procedure/method/etc. Cyclomatic Complexity is used to measure
number of paths in CFG Problem: Functions are not independent units
=> CFGs should be connected to give real picture
![Page 17: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/17.jpg)
Motivation Program: set of the interconnected functions
Represented by directed graph of higher level nodes of CFGs connected in a graph
Available metrics measuring communication between functions: Number of input links Number of output links
There are no metrics measuring complexity by observing the paths through the graph higher level equivalent to CC
![Page 18: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/18.jpg)
Motivationsum(a, b){sum=0;if (a = b) {
sum := a + b;} else if (a>b){
while (a > b){sum +=
a;a--;
}sum += b;
}
else{while (b > a){
sum += b;
b--;}sum += a;
}return sum;
}
![Page 19: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/19.jpg)
Motivationsum_max(max, min){
sum = 0;
while (max > min){
sum += max;
max--;
}
sum += min;
return sum;
}
sum(a, b){
sum=0;
if (a = b) {
sum := a + b;
} else if (a>b){
sum:= sum_max(a,
b);
}
else{
sum:= sum_max(b,
a);
}
return sum;
}
![Page 20: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/20.jpg)
Motivationsum(a, b){
sum=0;if (a = b) {
sum := a + b;} else if (a>b){
sum+= a + sum(a-1, b);}else{
sum:= b + sum(b-1, a);}return sum;
}
![Page 21: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/21.jpg)
Parameters of complexity
Local control flow complexity for each observed CFG
Global control flow complexity complexity of the interactions between observed
CFGs the length of the chains of calls the length of chains when there are closed chains of
calls (recursion)
![Page 22: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/22.jpg)
Contents
Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work
![Page 23: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/23.jpg)
Recursive Complexity
LoR: Length of the Recursion number of branches (which is equivalent to the
number of nodes) in the recursive chain
![Page 24: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/24.jpg)
Q1: How to define Recursive Complexity (RC) if we know the Length of Recursion (LoR)? RC = LoR ???
In this case n self recursions have the same weight as one recursion whose chain contains n nodes
Answer: not good enough
RC = LoR2 ??? Show case:
mutual recursion of two functions four self-recursions
Open question: are these two cases the similarly maintainable
![Page 25: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/25.jpg)
Q2: How to define
Overall Path Complexity (OPC)
if we have in mind the definition of
Cyclomatic Complexity (CC) and
Recursive Complexity (RC)???
![Page 26: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/26.jpg)
Demonstration of OPC calc1(A)-> f(A).
f(0) -> 1;f(N) -> g(f(N-1)) + calc1(10).
g(0) -> 1;g(N) -> h(g(N-1)).
h(0) -> 0;h(N) -> case N of
1 -> 1;2 -> f(h(N-1))
end.
![Page 27: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/27.jpg)
Demonstration of OPC
![Page 28: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/28.jpg)
Contents
Introduction State of the Art Motivation Recursive Complexity Conclusion Future Work
![Page 29: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/29.jpg)
Conclusion Numerous complexity and maintainability
metrics but still some gaps To fill the gap we propose introducing:
Recursive Complexity Overall Path Complexity
Implemented and tested several variations of this recursion aware metrics Implementation included in RefactorErl http://
plc.inf.elte.hu/erlang/
![Page 30: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/30.jpg)
Contents
Introduction State of the Art Motivation Recursive Complexity Discussion Conclusion Future Work
![Page 31: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/31.jpg)
Future Work To implement RC and OPC
Integrate with the language independent SMIILE tool (SSQSA) [Budimac et al, 2012]
Validate on broader range of examples To explore if there is correlation between OPC
and Other metrics Execution time …
![Page 32: Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty](https://reader036.vdocuments.us/reader036/viewer/2022081515/56649e025503460f94aed6f3/html5/thumbnails/32.jpg)
Gordana Rakić, Zoran BudimacDepartment of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad Melinda TóthEotvos Lorand University Budapest