1.2 Object Oriented Design Metrics
Total Page:16
File Type:pdf, Size:1020Kb
UC Irvine UC Irvine Electronic Theses and Dissertations Title Analyzing Outliers in the Maven Central Repository with Object Oriented Design Metrics Permalink https://escholarship.org/uc/item/93b235sg Author Kadge, Saumitra Prabhat Publication Date 2020 License https://creativecommons.org/licenses/by/4.0/ 4.0 Peer reviewed|Thesis/dissertation eScholarship.org Powered by the California Digital Library University of California UNIVERSITY OF CALIFORNIA, IRVINE Analyzing Outliers in the Maven Central Repository with Object Oriented Design Metrics THESIS submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in Software Engineering by Saumitra Prabhat Kadge Thesis Committee: Professor Cristina Lopes, Chair Assistant Professor Iftekhar Ahmed Assistant Professor Joshua Garcia 2020 © 2020 Saumitra Prabhat Kadge TABLE OF CONTENTS LIST OF FIGURES......................................................................................................................... iv LIST OF TABLES ........................................................................................................................... v ACKNOWLEDGEMENTS ............................................................................................................. vi ABSTRACT OF THE THESIS ......................................................................................................vii Introduction ................................................................................................................................. 1 1.1 Motivations ............................................................................................................................................................. 1 1.2 Object Oriented Design Metrics ................................................................................................................. 1 1.2.1 Quality Model for Object Oriented Design (QMOOD) ......................................................... 1 1.2.2 Chidamber and Kemerer Object Oriented Metrics ............................................................... 4 1.3 Datasets of Design Metrics ............................................................................................................................ 7 1.3.1 Maven Dependency Dataset ............................................................................................................... 7 1.3.2 Bug Catalog of the Maven Ecosystem ........................................................................................... 9 1.3.3 Metrics Dataset of the Java Ecosystem ..................................................................................... 10 Building the Dataset ................................................................................................................ 11 2.1 Building the Dataset ....................................................................................................................................... 11 2.1.1 Maven Central Repository ................................................................................................................ 11 2.1.2 Reading the Maven Central Index ................................................................................................ 12 2.1.3 Downloading project JAR files ....................................................................................................... 13 2.2 Calculating the Design Metrics ................................................................................................................ 16 2.2.1 CKJM-extended ........................................................................................................................................ 17 2.2.2 JDepend ........................................................................................................................................................ 21 2.2.3 MariaDB database schema ............................................................................................................... 23 Analysis of the Dataset ............................................................................................................ 26 3.1 Approach to analysis ..................................................................................................................................... 26 3.2 Class level analysis.......................................................................................................................................... 27 3.2.1 Size metrics (LOC, WMC, NPM, RFC and LCOM) ................................................................. 28 3.2.2 Coupling metrics (Ce, CBO, Ca and NOC) ................................................................................. 31 3.2.3 Encapsulation and Cohesion metrics (DAM and LCOM3)............................................. 34 3.2.4 Inheritance metrics (DIT, MFA, IC and CBM)........................................................................ 36 3.2.5 Cohesion among methods of class (CAM) ............................................................................... 39 ii 3.2.6 Average method complexity (AMC)............................................................................................ 40 3.2.7 Measure of aggregation (MOA) ..................................................................................................... 40 3.3 Overall observations from class level analysis.............................................................................. 41 3.4 Package level analysis................................................................................................................................... 42 3.4.1 Size metrics (NC, NCC and NAC) ................................................................................................... 43 3.4.2 Efferent couplings (Ce) ....................................................................................................................... 45 3.4.3 Popularity metrics (Ca, 푨, 푰 and DMM) .................................................................................... 46 3.5 Overall observations from package level analysis ...................................................................... 49 Conclusion ................................................................................................................................. 50 4.1 Limitations ........................................................................................................................................................... 50 4.2 Future Work........................................................................................................................................................ 51 4.3 Conclusion ............................................................................................................................................................ 51 Bibliography.............................................................................................................................. 52 Appendix .................................................................................................................................... 57 iii LIST OF FIGURES Figure 2.1 – POM file template. ................................................................................................................................... 14 Figure 2.2 – Complete POM file for an artifact. ................................................................................................. 15 Figure 2.3 – CKJM-extended output. ........................................................................................................................ 20 Figure 2.4 – JDepend output. ........................................................................................................................................ 23 Figure 2.5 – Database schema. .................................................................................................................................... 24 Figure 3.1 – Correlation matrix for class level metrics. ............................................................................... 28 Figure 3.2 – Lines of Code .............................................................................................................................................. 30 Figure 3.3 – Weighted Methods per Class ............................................................................................................ 30 Figure 3.4 – Number of Public Methods ................................................................................................................ 30 Figure 3.5 – Response for a Class .............................................................................................................................. 31 Figure 3.6 – Lack of Cohesion in Methods............................................................................................................ 31 Figure 3.7 – Efferent Couplings .................................................................................................................................. 33 Figure 3.8 – Coupling Between Object Classes.................................................................................................. 33 Figure 3.9 – Afferent Couplings .................................................................................................................................. 33 Figure 3.10 – Number of Children............................................................................................................................. 34 Figure 3.11 – Data