Prototype of the “new” Software metrics tool Gordana Rakić, Zoran Budimac.

Slides:



Advertisements
Similar presentations
Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
Advertisements

ANTLR in SSP Xingzhong Xu Hong Man Aug Outline ANTLR Abstract Syntax Tree Code Equivalence (Code Re-hosting) Future Work.
Professor Michael J. Losacco CIS 1150 – Introduction to Computer Information Systems Programming and Languages Chapter 13.
CPSC Compiler Tutorial 9 Review of Compiler.
On a Literature/Tool Review on Software Metrics Tools Gordana Rakic.
Introduction to System Analysis and Design
Visual Web Information Extraction With Lixto Robert Baumgartner Sergio Flesca Georg Gottlob.
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
Programming Languages Structure
SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac.
CS 153: Concepts of Compiler Design August 25 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
Advanced Topics in Software Engineering ATSE 2009 Topics, participants and results Gordana Rakic, Zoran Budimac.
USING SOFTWARE METRICS IN EDUCATIONAL ENVIRONMENT Ivan Pribela, Zoran Budimac, Gordana Rakić.
ANTLR.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Building Applications.
CS102 Introduction to Computer Programming
University of Toronto Department of Computer Science © 2001, Steve Easterbrook CSC444 Lec22 1 Lecture 22: Software Measurement Basics of software measurement.
Programming Languages – Coding schemes used to write both systems and application software A programming language is an abstraction mechanism. It enables.
Software Metrics *** state of the art, weak points and possible improvements Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics, Faculty.
Invitation to Computer Science 5th Edition
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Implementation Yaodong Bi. Introduction to Implementation Purposes of Implementation – Plan the system integrations required in each iteration – Distribute.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
PLATFORM INDEPENDENT SOFTWARE DEVELOPMENT MONITORING Mária Bieliková, Karol Rástočný, Eduard Kuric, et. al.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
Reviewing Recent ICSE Proceedings For:.  Defining and Continuous Checking of Structural Program Dependencies  Automatic Inference of Structural Changes.
Product Metrics An overview. What are metrics? “ A quantitative measure of the degree to which a system, component, or process possesses a given attribute.”
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
Cross Language Clone Analysis Team 2 October 27, 2010.
Abstract We present two Model Driven Engineering (MDE) tools, namely the Eclipse Modeling Framework (EMF) and Umple. We identify the structure and characteristic.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
Chapter 12: Design Phase n 12.1 Design and Abstraction n 12.2 Action-Oriented Design n 12.3 Data Flow Analysis n Data Flow Analysis Example n
ProgrammingLanguages Programming Languages Language Definition, Translation and Design.
XML Grammar and Parser for WSOL Kruti Patel, Vladimir Tosic, Bernard Pagurek Network Management & Artificial Intelligence Lab Department of Systems & Computer.
Towards the better software metrics tool motivation and the first experiences Gordana Rakić Zoran Budimac.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Overview of Previous Lesson(s) Over View  A program must be translated into a form in which it can be executed by a computer.  The software systems.
Chapter 1 Introduction Study Goals: Master: the phases of a compiler Understand: what is a compiler Know: interpreter,compiler structure.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Slide 13.1 © The McGraw-Hill Companies, 2002 Object-Oriented and Classical Software Engineering Fifth Edition, WCB/McGraw-Hill, 2002 Stephen R. Schach.
Gordana Rakić, Zoran Budimac
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
Automatically detecting and describing high level actions within methods Presented by: Gayani Samaraweera.
1 Measuring Similarity of Large Software System Based on Source Code Correspondence Tetsuo Yamamoto*, Makoto Matsushita**, Toshihiro Kamiya***, Katsuro.
SSQSA present and future Gordana Rakić, Zoran Budimac Department of Mathematics and Informatics Faculty of Sciences University of Novi Sad
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
Cross Language Clone Analysis Team 2 February 3, 2011.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
Chap. 7, Syntax-Directed Compilation J. H. Wang Nov. 24, 2015.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Your Interactive Guide to the Digital World Discovering Computers 2012 Chapter 13 Computer Programs and Programming Languages.
Software Testing.
Chapter 1 The Systems Development Environment
Chapter 1 Introduction.
Introduction to Compiler Construction
CSCI-235 Micro-Computer Applications
Unified Modeling Language
Chapter 1 Introduction.
Chapter 1 The Systems Development Environment
Compiler Lecture 1 CS510.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Compiler Construction
Chapter 1 The Systems Development Environment
Presentation transcript:

Prototype of the “new” Software metrics tool Gordana Rakić, Zoran Budimac

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Abstract First prototype of “universal” software metrics tool Characteristics –Platform independency Developed in Java Programming Language –Application range Two programming languages (Modula-2 and Java) Two software metrics (CC and LOC) –Annotated syntax tree based source code and metric values representation - enables Source code and metric values history Language independency of the tool

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Motivation Systematic application of software metrics techniques can significantly improve the quality of a software product The most important weaknesses of current techniques and tools: –Many techniques/tools are appropriate for only one programming language or for one type of programming languages –Support of object-oriented metrics is still weak –Many techniques/tools compute numerical results with no real interpretation of their meanings –There are no hints and advices what typical actions should be taken in order to improve the software –The technique/tool should discourage cheating –Current techniques/tools are not sensitive to the existence of additional code –Sometimes is not clear which specific software metric have to be applied to accomplish the specific goal. [Budimac, Hericko, 2010]

…From the reviewers’ point of view [ICSOFT 2010] “This paper motivates the needs of a “universal” software metrics tool and presents the main design lines of the prototype. Having a robust and flexible metric tools is really valuable for any software engineering effort” “The authors present a vision of a unified software metrics tool that is able to wipe away the frustrating differences between programming languages and provide a single, universal set of metrics that can be applied uniformly to all software. This is a laudable vision, and if it were achievable it would be a truly remarkable step forward. “

… From the colleagues’ point of view* The most important step forward, but the most complicated one would be development of support for all, as well as for “ancient” programming languages… Programmers’ cheatingin measuring process is frequent problem Reasoning in measurement process is important  Thanks to Nataša Ibrajter Zvonimir Dudan Dragan Maćoš

…Motivation and this thesis… Many techniques/tools are appropriate for only one programming language or for one type of programming languages Support of object-oriented metrics is still weak Many techniques/tools compute numerical results with no real interpretation of their meanings There are no hints and advices what typical actions should be taken in order to improve the software The technique/tool should discourage cheating Current techniques/tools are not sensitive to the existence of additional code Sometimes is not clear which specific software metric have to be applied to accomplish the specific goal. PLUS –Platform dependency –Support for other metrics –History of source code –History of calculated metrics

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Background (1) Software metrics [Kan, 2003], [Budimac et al., 2008] –numerical values –reflect some property of whole software product one piece of software product specification of software product Software metrics : software property  numeric value

Background (2) 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

Background (3) Some of Software metrics –Lines of Code (LOC) family LOC Lines of Source Code (SLOC) Lines of Comments (CLOC) Lines of Commented Source Code (CSLOC) Physical LOC (FLOC) Logical LOC (LLOC) –Cyclomatic Complexity (CC) –Halstead Metrics (H) –Object Oriented Metrics (OO) – family –…

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Related work Review of software metric tools available for usage –Based on testing Review of available literature –Based on research papers available development and product documentation

Tools review Criteria –Platform dependency –Programming language dependency –Supported metrics –History of code storing facility –History of metrics storing facility

Tools review (2) Table 1. Software metric tools review by criteria _________________________________________ [1 ] [1 ] The tool is not independent of programming language, but there is a clear idea for achieving independence in its future development ToolSee ref Platform independ. IPL independ. Supported SM Code hist. Metrics hist. cchlocooothers SLOC Wheeler, Code Counter Pro Geronesoft, Source Monitor Campwood Software, UnderstandScientificToolworks, RSM MSquaredTechnologies, Krakatau Power Software, *+*

Literature Review (1) ATHENA (Christodoulakis et al., 1989) –software quality certification tool –based on the parsers that generate abstract syntax trees as a representation of the source code for application of the metric algorithms –only executable on UNIX operating system. –more details about this tool as well as information about its further development are not available. Codesquale metrics tool (CodeSquale, 2009) –based on abstract syntax trees representation of source code –one object oriented metric for source code written in Java language was realized with described idea for the further development –stated final goal was programming language independency –later results were not published. Tool for static analysis (Truong et al., 2004) –Static analysis of student programs written in the Java programming language –based on abstract syntax tree (AST) representation of the source code (in the XML format)

Literature Review (2) Language independency in some related areas of source code analysis based on Abstract Syntax Tree representation of the source code –duplicated code analysis (Ducasse et al., 1999) –code clone analysis (Baxter et al., 1998) –detection of similar classes in the program code written in the Java programming language (Sager et al., 2006) –monitoring of changes or program code written in the Java programming language (Neamtiu et al., 2005)

Review conclusion Practice needs new tool which Is platform independent Is programming language independent Calculates broad specter of metrics Supports keeping of source code history Supports keeping of calculated values of software metrics

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Description The tool architecture Background of universality Implementation of metric algorithms Structure of the application

Tool Architecture

Parser Generators Tool used for generation of language translators Input –language grammar Output –Language scanner –Language parser + Intermediate representation of language constructions !syntax trees!

Syntax Trees –Intermediate structure produced by parser generator directly translator generated by parser generator Represent –language in abstract form –concrete source code –concrete source code elements attached to corresponding abstract language elements

Syntax Trees (2) Classification of Syntax trees used in this thesis –Abstract Syntax Tree (AST) represents concrete source code –Concrete Syntax Tree (CST) represents concrete source code elements attached to corresponding abstract language elements –Enriched Concrete Syntax Tree (eCST) Represents concrete source code elements attached to corresponding abstract language elements Contains additional information - universal nodes as markers for language elements figuring in metric algorithms

Description The tool architecture Background of universality Implementation of metric algorithms Structure of the application

Background of universality Enriched Concrete Syntax Tree (eCST) –Generated by Parser generator Generation is based on programming language grammar Enrichment is based on modification of programming language grammar by adding universal nodes into tree –Stored to XML structure Enrichment does not effect structure of the tree –Only content of the tree is affected by these changes

Structure of the eCST

Content of the CST and eCST Universal Nodes IF parenthesizedExpression ifStat = statement (ELSE elseStat = statement -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat)) ^(BRANCH ELSE $elseStat))| -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat))) )

Storing additional data - Programming Languages - Enables dynamic recognition of input programming language based on input file extension

Storing additional data - Calculated Software Metrics Values - Enables further processing in the future

Information flow trough the tool

Description The tool architecture Background of universality Implementation of metric algorithms Structure of the application

Metric algorithms In current prototype –metrics Cyclomatic Complexity – CC (by predicate counting) Lines of Code – LOC (by filled lines counting) –Programming languages Java Modula 2 –All calculations and tree transformations in one pass through code XML eCST is large for multiple parsing

Metric algorithms (2)

Metric Algorithms (3) Two functions implementing metric algorithms –measureAndTransform(inputNode, outputNode) – measureAndTransform (inputNode, outputNode, tempOutputNode)

Metric Algorithms (4) // measureAndTransform(inputNode, outputNode) if (attribute = "ABSTRACT_UNIT_DECL or attribute = "CONCRETE_UNIT_DECL" or attribute = "BRANCH_STATEMENT") then begin add new element to output tree; set initial software metric values for new element; recursive call measureAndTransform( current child of input node current output node temporary output node ); end;

Metric Algorithms (5) // measureAndTransform(inputNode, outputNode) if (attribute = "BRANCH" or attribute = "FUNCTION_DECL" or attribute = "MAIN_BLOCK" or attribute = "LOOP_STATEMENT or attribute = "LOGICAL_AND" or attribute = "LOGICAL_OR or attribute = "PREDICATE") then begin add new element to output tree; set initial software metric values for new element; increase value of CC for new element by 1; recursive call measureAndTransform( current child of input node current output node temporary output node ); end;

Metric Algorithms (6) // measureAndTransform(inputNode, outputNode) else begin take care about number of line; for (each child of input node) begin recursive call measureAndTransform( current child of input node, temporary output node); end

Metric Algorithms (7) //measureAndTransform(inputNode, outputNode, tempOutputNode) for(each child of input node) begin recursive call measureAndTransform(current child of input node, temporary output node); end Calculate LOC for temporary output node; (* LOC = lastLineOfTheElement – firstLineOfTheElement + 1 *) add temporary output node as child of output node; Increase CC of output node by CC of temporary output node; Increase LOC of output node by LOC of temporary output node;

Description The tool architecture Background of universality Implementation of metric algorithms Structure of the application

Structure of the application

Structure of the application - package Languages -

Structure of the application - package XMLCST -

Structure of the application - package MetricStructure -

Structure of the application - Default package - Class Parse –Receives input file containing source code –Generates enriched CST in XML format –Uses package Languages and XMLCST Class Measure –Receives enriched CST in XML format –Calculates Software Metric Values –Uses package XMLCST and MetricStructure

Adding support for new Programming Language if (support for new PL is needed) then begin modify existing grammar* of new PL (add universal nodes); generate parser; add new element in Languages XML structure end ____________________________________________ *Different grammars are supported by different parser generators. As we use ANTLR parser generator in this prototype grammar of new language should be LL(*)

Adding support for new Software Metrics if (support for new Software Metrics is needed) then begin determine corresponding new universal nodes; modify grammars for all supported languages; regenerate language parsers; add attribute for storing new metric in XML structure for storing metric values; add software metric algorithm implementation in measure class end

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Example QuickSort.mod PROCEDURE Sort(VAR niz : NizTip; Levi, Desni : Indeks); … BEGIN … REPEAT WHILE (niz[i] < Sredina ) DO INC(i); END; WHILE (niz[j] > Sredina) DO DEC(j); END; IF (i <= j) THEN … END; UNTIL (i > j); IF (Levi < j) THEN Sort(niz, Levi, j); END; IF (i < Desni) THEN Sort(niz, i, Desni); END END Sort; QuickSort.java public static void sort(int[] niz,int levi, int desni) { … do{ while (niz[i] < sredina) i++; while (niz[j] > sredina) j--; if (i <= j) { … } }while (i <= j); if (levi < j) sort(niz, levi, j); if (i < desni) sort(niz, i, desni); }

Example - results

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Results and conclusion Motivation and background for development of new software metrics tool which is –Is platform independent –Is programming language independent –Calculates broad specter of metrics –Supports keeping of source code history –Supports keeping of calculated values of software metrics

Results and conclusions (2) Developed prototype of new software metrics tool which is –Developed in PL Java is platform independent –Developed to support two input PLs Is not programming language independent but base for it is sited –Developed to support two Software Metrics Specter of metrics is not broad but base for it is sited –Supports keeping of source code history –Supports keeping of calculated values of software metrics ! It analyzes single compilation unit stores to single input file

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

Future work Adding support for additional PLs –Ancient PLs – Cobol and Fortran ?! Adding support for additional Software Metrics –For OO metrics relationships between compilation units are needed ! Interpret calculated metric values –Represent them graphically –Interpret their meaning in order to provide useful information to the user

Contents Abstract (what we did) Motivation (why we did it) Background (basic information on the subject) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work References

References [Baxter et al., 1998] I.D.Baxter, A. Yahin, L. Moura, M. Sant'Anna, L. Bier, Clone Detection Using Abstract Syntax Trees, Proceedings of International Conference on Software Maintenance, ISBN: , pp [Budimac et al., 2008] Z.Budimac, Ivanović M., Odabrana poglavlja iz softverskog inzenjerstva i savremenih racunarskih tehnologija, Prirodno-matematički fakultet, Novi Sad, 2008, p.320, ISBN [Christodoulakis et al., 1989] D.N. Christodoulakis, C. Tsalidis, C.J.M. van Gogh, V.W. Stinesen, Towards an automated tool for Software Certification, International Workshop on Tools for Artificial Intelligence, Architectures, Languages and Algorithms, IEEE, ISBN: , pp [Ducasse et al., 1999] S. Ducasse, M. Rieger, S. Demeyer, A Language Independent Approach for Detecting Duplicated Code, Proceedings. IEEE International Conference on Software Maintenance, (ICSM '99), ISBN: , pp [Ebert, Dumke, 2007] C.Ebert, R.Dumke, Software Measurement – Establish Extract Evaluate Execute, Springer – Verlag, Berlin, Heidelberg, New York 2007, ISBN [Ebert et al., 2005] C. Ebert, R.Dumke, M. Bundschuh, A. Schmietendorf, Best Practices in Software Measurement - How to use metrics to improve project and process performance, Springer-Verlag Berlin Heidelberg, 2005, ISBN [Erdogmus, Tanir, 2002] H. Erdogmus, O. Tanir, Advances in software engineering: comprehension, evaluation, and evolution, Springer – Verlag, Berlin, Heidelberg, New York 2002, ISBN

References [Grune et al., 2000] Grune D., Bal H.E., Jacobs C.J.H., Langendoen K.G., Modern compiler design, – John Wiley & Sons, England, 2000, ISBN , 753p [Johnes, 2008] Capers Jones, Applied Software Measurement - Global Analysis of Productivity and Quality – Third Edition, The McGraw-Hill Companies, 2008, ISBN , 662p. [Kan, 2003] S. Kan, Metrics and Models in Software Quality Engineering – Second Edition, Addison-Wesley, Boston, 2003, ISBN [Neamtiu et al., 2005] I. Neamtiu, J. S. Foster, M. Hicks, Understanding source code evolution using abstract syntax tree matching, Proceedings of the International Conference on Software Engineering 2005, international workshop on Mining software repositories, ISBN: , pp 1–5 [Parr, 2007] Parr T., The Definitive ANTLR Reference - Building Domain-Specific Languages, The Pragmatic Bookshelf, USA, 2007, ISBN: [Rakić, Budimac, Bothe, 2010]Rakić G., Budimac Z., Bothe K., Towards a ‘Universal’ Software Metrics Tool - Motivation, Process and a Prototype, Proceedings of the 5th International Conference on Software and Data Technologies (ICSOFT), 2010, accepted [Sager et al, 2006]. T. Sager, A. Bernstein, M. Pinzger, C. Kiefer, Detecting Similar Java Classes Using Tree Algorithms, Proceedings of the International Conference on Software Engineering 2006, international workshop on Mining software repositories, ISBN: , pp [Truong et al., 2004] N. Truong, P. Roe, P. Bancroft, Static Analysis of Students’ Java Programs, Sixth Australian Computing Education Conference (ACE2004), Dunedin, New Zealand. Conferences in Research and Practice in Information Technology, Vol. 30., 2004, pp

Web References/References to the Tools [AivostoOy, 2009a] "Tutorial: How to use Project Analyzer v9, ©1998–2008 Aivosto Oy URN:NBN:fi-fe " [AivostoOy, 2009b] [Budimac, Hericko, 2010] CV.pdf CV.pdf [CampwoodSoftware, 2009] SourceMonitor, [Coco/R, 2010] Coco/R [CodeSquale, 2009a] CodeSquale [CodeSquale, 2009b] CodeSquale [Geronesoft, 2009]

Web References/References to the Tools [McCabe, 2010] [Parr, 2009] ANTLR [PowerSoftware, 2009a] Krakatau Suite Management Overview, [PowerSoftware, 2009b] Krakatau Essential PM (KEPM)- User guide , [ScientificToolworks, 2009] Understand 2.0 User Guide and Reference Manual, Copyright © 2008 Scientific Toolworks, March [SmLab, 2009] Software Measurement Labaratory, TOOL OVERVIEW, [Wheeler, 2009] SLOCCount User's Guide, David A. Wheeler, August 1, 2004, Version

Thank you Hvala