Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty.

Similar presentations


Presentation on theme: "Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty."— Presentation transcript:

1 Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad Melinda Tóth Eotvos Lorand University Budapest

2 Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work

3 Abstract By target  Process  Product  Resources By availability  Internal  External By measurement object  Size  Complexity  Structure  Architecture By applicability  Specification  Design  Source code  … (Some of) Software metrics classifications

4 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  …

5 Question Could some of these changes be generalized by introducing new metrics?

6 Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work

7 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

8 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.

9 Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Discussion Conclusion Future Work

10 State of the Art Complexity and size metrics  LOC  Halstead  Cyclomatic Complexity ...  Derived metrics

11 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]

12 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 ...

13 Question How RECURSION affect complexity and maintainability? How to measure it?

14 Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work

15 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

16 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

17 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

18 Motivation sum(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; }

19 Motivation sum_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; }

20 Motivation sum(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; }

21 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)

22 Contents Abstract Introduction State of the Art Motivation Recursion Aware Complexity Conclusion Future Work

23 Recursive Complexity LoR: Length of the Recursion  number of branches (which is equivalent to the number of nodes) in the recursive chain

24 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 = LoR 2 ???  Show case: mutual recursion of two functions four self-recursions  Open question: are these two cases the similarly maintainable

25 Q2: How to define Overall Path Complexity (OPC) if we have in mind the definition of Cyclomatic Complexity (CC) and Recursive Complexity (RC) ???

26 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.

27 Demonstration of OPC

28 Contents Introduction State of the Art Motivation Recursive Complexity Conclusion Future Work

29 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/ http://plc.inf.elte.hu/erlang/

30 Contents Introduction State of the Art Motivation Recursive Complexity Discussion Conclusion Future Work

31 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  …

32 Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad Melinda Tóth Eotvos Lorand University Budapest


Download ppt "Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty."

Similar presentations


Ads by Google