An Approach to Measure Java Code Quality in



![Motivation n Reuse environment [Frakes, 1994] ¡ ¡ Process Metrics Assets Tools http: //www. Motivation n Reuse environment [Frakes, 1994] ¡ ¡ Process Metrics Assets Tools http: //www.](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-4.jpg)
![Motivation n n Component Repository promote reuse success [Griss, 1994] Search Engine[Garcia, 2006] ¡ Motivation n n Component Repository promote reuse success [Griss, 1994] Search Engine[Garcia, 2006] ¡](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-5.jpg)


![Quality in a Reuse Environment [Etzkorn, 2001] n ISO 9126 http: //www. rise. com. Quality in a Reuse Environment [Etzkorn, 2001] n ISO 9126 http: //www. rise. com.](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-8.jpg)


![Most Referenced Metrics n LOC n Cyclomatic Complexity [Mc. Cabe, 1976] n Chidamber and Most Referenced Metrics n LOC n Cyclomatic Complexity [Mc. Cabe, 1976] n Chidamber and](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-11.jpg)
![Problems related to Metrics [Ince, 1988 and Briand, 2002] n Metrics Validation ¡ ¡ Problems related to Metrics [Ince, 1988 and Briand, 2002] n Metrics Validation ¡ ¡](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-12.jpg)










![Referências n n n [Frakes, 1994] W. B. Frakes and S. Isoda, "Success Factors Referências n n n [Frakes, 1994] W. B. Frakes and S. Isoda, "Success Factors](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-23.jpg)

- Slides: 24

An Approach to Measure Java Code Quality in Reuse Environment Master: Aline Timóteo Professor: Silvio Meira UFPE – Federal University of Pernambuco alt@cin. ufpe. br http: //www. rise. com. br

Summary n n Motivation Background ¡ ¡ n n Quality in a Reuse Environment Metrics An Approach to Measure Java Code Quality Main Contributions http: //www. rise. com. br

Motivation http: //www. rise. com. br
![Motivation n Reuse environment Frakes 1994 Process Metrics Assets Tools http www Motivation n Reuse environment [Frakes, 1994] ¡ ¡ Process Metrics Assets Tools http: //www.](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-4.jpg)
Motivation n Reuse environment [Frakes, 1994] ¡ ¡ Process Metrics Assets Tools http: //www. rise. com. br
![Motivation n n Component Repository promote reuse success Griss 1994 Search EngineGarcia 2006 Motivation n n Component Repository promote reuse success [Griss, 1994] Search Engine[Garcia, 2006] ¡](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-5.jpg)
Motivation n n Component Repository promote reuse success [Griss, 1994] Search Engine[Garcia, 2006] ¡ Analyze a set of Search Engines ¡ Requirements n Artifact filtering http: //www. rise. com. br

Problem n Artifacts quality ¡ ¡ n In search time? How to eliminate low-quality artifacts? In other words… How to eliminate low-quality artifacts in search time? http: //www. rise. com. br

Background http: //www. rise. com. br
![Quality in a Reuse Environment Etzkorn 2001 n ISO 9126 http www rise com Quality in a Reuse Environment [Etzkorn, 2001] n ISO 9126 http: //www. rise. com.](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-8.jpg)
Quality in a Reuse Environment [Etzkorn, 2001] n ISO 9126 http: //www. rise. com. br

Metrics n n “Software metrics is a method to quantify attributes in software processes, products and projects” [Daskalantonakis, 1992] Metrics Timeline ¡ ¡ Age 1: before 1991, where the main focus was on metrics based on the code complexity Age 2: after 1992, where the main focus was on metrics based on the concepts of Object Oriented (OO) systems http: //www. rise. com. br

Age 1: Complexity Age 2: Object Oriented http: //www. rise. com. br
![Most Referenced Metrics n LOC n Cyclomatic Complexity Mc Cabe 1976 n Chidamber and Most Referenced Metrics n LOC n Cyclomatic Complexity [Mc. Cabe, 1976] n Chidamber and](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-11.jpg)
Most Referenced Metrics n LOC n Cyclomatic Complexity [Mc. Cabe, 1976] n Chidamber and Kemerer Metrics [Chidamber, 1994] n Lorenz and Kidd Metrics [Lorenz, 1994] n MOOD Metrics [Brito, 1994] http: //www. rise. com. br
![Problems related to Metrics Ince 1988 and Briand 2002 n Metrics Validation Problems related to Metrics [Ince, 1988 and Briand, 2002] n Metrics Validation ¡ ¡](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-12.jpg)
Problems related to Metrics [Ince, 1988 and Briand, 2002] n Metrics Validation ¡ ¡ ¡ n Measurement goal Experimental hypothesis Environment or context Theoretical Validation Empirical validation Metrics Automation ¡ ¡ ¡ Different set of metrics implemented Bad documentation Quality attributes x Metrics http: //www. rise. com. br

An Approach to Measure Java Code Quality http: //www. rise. com. br

An Approach to Measure Java Code Quality n Quality Attributes x Metrics n Metrics Selection and Specification n Quality Attributes measurement http: //www. rise. com. br

Quality Attributes x Metrics Quality Attributes Code Attributes size Analysability LOC CK Metrics WMC DIT x x NOC CBO RFC LCOM x X X x complexty documentation Cyclomatic Complexity x complexity modularity/ encapsulation Changeability X coupling x X cohesion X inheritance x Stability Testability complexity x x x coupling x complexidade documentation Reusability X x x x X X X x x modularity/ encapsulation x coupling X cohesion x x http: //www. rise. com. br

Quality Attributes x Metrics Quality Attributes Code Attributes Analysability size complexty documentation complexity Changeability modularity/ encapsulation coupling cohesion inheritance PIM x NIV x NCM x x Stability Testability Reusability Lorenz and Kidd NCV NMO x complexity coupling complexidade documentation modularity/ encapsulation coupling cohesion http: //www. rise. com. br NMI NMA SIX x x x APPM

Quality Attributes x Metrics MOOD Metrics Quality Attributes Code Attributes MHF AHF MIF AIF size Analysability complexty documentation complexity modularity/ encapsulation Changeability coupling cohesion inheritance Stability Testability complexity coupling complexity documentation Reusability modularity/ encapsulation coupling cohesion http: //www. rise. com. br x x PF

Metrics Selection and Specification - Theoretical Validation - Empirical Validation - Tools -LOC -Cyclomatic Complexity - CK Metrics http: //www. rise. com. br

Analysis Definition Metrics Selection and Specification Response for a Class Short name RFC The response set of a class is a set of methods that can potentially be executed in response to a Description message received by an object of that class. RFC = M + R M = number of methods in the class R = number of remote methods directly called Calculated by by methods of the class Allowable value RFC<=50 Private No Presentation N/A Range of analysis When the development cycle is done Analysis procedure Identify how classes have a highest responsibility Responsible Metrics Analyst http: //www. rise. com. br

Quality Attributes Measurement (QAM) n QAM = (the number of metrics that have a allowable value) n QAM >= Number of metrics /2 n Example: n Quality Attribute Code Attribute Testability complexity coupling CK Metrics WMC x DIT x CBO x RFC LCOM x x x 2, 5 <= QAM <= 5 http: //www. rise. com. br

Contributions n Introduce quality analysis in a search engine ¡ ¡ n Store assets and their quality attributes In the search time the asset is recovered according quality attribute values Quality attributes x Code metrics ¡ ISO 9126 http: //www. rise. com. br

Current Stage n Sate-of-the-art in Software Metrics n Approach definition n Prototypal Implementation (partial) n Integration with B. A. R. T. (next step) n Experiment (next step) http: //www. rise. com. br
![Referências n n n Frakes 1994 W B Frakes and S Isoda Success Factors Referências n n n [Frakes, 1994] W. B. Frakes and S. Isoda, "Success Factors](https://slidetodoc.com/presentation_image_h2/fcf3a175f5844d5f4b67284ce216028f/image-23.jpg)
Referências n n n [Frakes, 1994] W. B. Frakes and S. Isoda, "Success Factors of Systematic Software Reuse, " IEEE Software, vol. 11, pp. 14 -19, 1994. [Griss, 1994] M. L. Griss, "Software Reuse Experience at Hewlett-Packard, " presented at 16 th International Conference on Software Engineering (ICSE), Sorrento, Italy, 1994. [Garcia, 2006] V. C. Garcia, D. Lucrédio, F. A. Durão, E. C. R. Santos, E. S. Almeida, R. P. M. Fortes, and S. R. L. Meira, "From Specification to Experimentation: A Software Component Search Engine Architecture, " presented at The 9 th International Symposium on Component-Based Software Engineering (CBSE 2006), Mälardalen University, Västerås, Sweden, 2006. [Etzkorn, 2001] Letha H. Etzkorn, William E. Hughes Jr. , Carl G. Davis: Automated reusability quality analysis of OO legacy software. Information & Software Technology 43(5): 295 -308 (2001) [Daskalantonakis, 1992] M. K. Daskalantonakis, “A Pratical View of Software Measurement and Implementation Experiences Within Motorola”, IEEE Transactions on Software Engineering, vol 18, 1992, pp. 998– 1010. [Mc. Cabe, 1976] T. J. Mc. Cabe, “A Complexity Measure”. IEEE Transactions of Software Engineering, vol SE-2, 1976, pp. 308320. [Chidamber, 1994] S. R. Chidamber, C. F. Kemerer, “A Metrics Suite for Object Oriented Design”, IEEE Transactions on Software Engineering, vol 20, Piscataway - USA, 1994, pp. 476 -493. [Lorenz, 1994] M. Lorenz, J. Kidd, “Object-Oriented Software Metrics: A Practical Guide”, Englewood Cliffs, New Jersey - USA, 1994. [Brito, 1994] A. F. Brito, R. Carapuça, "Object-Oriented Software Engineering: Measuring and controlling the development process", 4 th Interntional Conference on Software Quality, USA, 1994. [Ince, 1988] D. C. Ince, M. J. Sheppard, "System design metrics: a review and perspective", Second IEE/BCS Conference, Liverpool - UK, 1988, pp. 23 -27. [Briand, 2002] L. C. Briand, S. Morasca, V. R. Basili, “An Operational Process for Goal-Driven Definition of Measures”, Software Engineering - IEEE Transactions, vol 28, 2002, pp. 1106 -1125. [Morasca, 1989] S. Morasca, L. C. Briand, V. R. Basili, E. J. Weyuker, M. V. Zelkowitz, B. Kitchenham, S. Lawrence Pfleeger, N. Fenton, "Towards a framework for software measurementvalidation", Software Engineering, IEEE Transactions, vol 23, 1995, pp. 187 -189. http: //www. rise. com. br

Aline Timóteo UFPE – Federal University of Pernambuco alt. timoteo@gmail. com http: //www. rise. com. br