1 / 32

Software Metrics *** state of the art, weak points and possible improvements

This article explores the current state of software metrics, identifies their weaknesses, and proposes potential improvements. It discusses the impact of recursion on complexity and maintainability and presents various metrics for measuring software quality and complexity.

amynadeau
Télécharger la présentation

Software Metrics *** state of the art, weak points and possible improvements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 Bytarget 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 HowRECURSION 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(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; } sum_max(max, min){ sum = 0; while (max > min){ sum += max; max--; } sum += min; 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 = LoR2 ??? • 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 ofCyclomatic 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/

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

  31. 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 • …

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

More Related