Towards the Development of a Cohesive Design-Driven Code Quality Metrics
Total Page:16
File Type:pdf, Size:1020Kb
University of Texas at El Paso ScholarWorks@UTEP Open Access Theses & Dissertations 2020-01-01 Towards the Development of a Cohesive Design-Driven Code Quality Metrics Omar Masmali University of Texas at El Paso Follow this and additional works at: https://scholarworks.utep.edu/open_etd Part of the Computer Sciences Commons Recommended Citation Masmali, Omar, "Towards the Development of a Cohesive Design-Driven Code Quality Metrics" (2020). Open Access Theses & Dissertations. 3180. https://scholarworks.utep.edu/open_etd/3180 This is brought to you for free and open access by ScholarWorks@UTEP. It has been accepted for inclusion in Open Access Theses & Dissertations by an authorized administrator of ScholarWorks@UTEP. For more information, please contact [email protected]. TOWARDS THE DEVELOPMENT OF A COHESIVE DESIGN-DRIVEN CODE QUALITY METRICS OMAR MASMALI Doctoral Program in Computer Science APPROVED: Omar Badreddin, Ph.D., Chair Vladik Kreinovich, Ph.D. Mohamed Khamsi, Ph.D. Stephen L. Crites, Jr., Ph.D. Dean of the Graduate School Copyright © by Omar Masmali 2020 To My Father. TOWARDS THE DEVELOPMENT OF A COHESIVE DESIGN-DRIVEN CODE QUALITY METRICS by OMAR MASMALI DISSERTATION Presented to the Faculty of the Graduate School of The University of Texas at El Paso in Partial Fulfillment of the Requirements for the Degree of DOCTOR OF PHILOSOPHY Department of Computer Science THE UNIVERSITY OF TEXAS AT EL PASO December 2020 ACKNOWLEDGEMENTS I would like to express my deepest appreciation to my advisor Dr. Badreddin, who have been supportive of my PhD study and who worked actively to provide me with the academic guidance to pursue this degree. His willingness to give his time so generously and enthusiastic encouragement and useful critiques has been very much appreciated. I would also like to extend my deepest gratitude to the members of my family. I would like to thank my parents, whose love and guidance are with me in whatever I pursue. They are the ultimate role models. Most importantly, I wish to thank my loving and supportive wife and my four wonderful children, Mohammad, Lamar, Abdullah, and Manar, who provide unending inspiration. This work would not have been possible without the financial support of the Technical and Vocational Training Corporation (TVTC) in Saudi Arabia. v ABSTRACT Software complexity is an indicator of the expected future maintenance and sustainability. Excessive complexity suggests that software or a component of software has a design or implementation that is difficult to understand, modify, and maintain. Several complexity measures have been developed by researchers to identify and characterize degrees of complexity. Code smells are widely adopted as indicators for low code quality. Many studies have adopted fixed threshold values for code smells and other quality metrics. These fixed threshold values often ignore the uniqueness of each software system and the unique roles each component play. Moreover, these thresholds are largely fixed throughout the software development lifecycle. Complexity frameworks that adopt fixed thresholds do not adequately consider variations in development technologies and the architectural roles of various code and design elements. This is a significant limitation particularly at this period where software platforms, middleware, and contexts are going through a rapid period of flux. This dissertation reports on a novel software complexity metrics that adopts dynamic threshold values. This approach ensures that the derived metrics are uniquely tailored for the software under development, sensitive to the architectural roles played by modules, and that the metrics and their thresholds can dynamically evolve throughout the software lifecycle. This research is motivated by the following hypothesis: Sustainability metrics that are derived from software designs provide better characterization of codebase quality and sustainability than traditional metrics. This dissertation presents two main contributions as follows. The first contribution is a study that proposes novel complexity metrics derived from the software design. In order to establish a fundamental foundation for these metrics, a theoretical vi and practical evaluation is performed. The theoretical evaluation is performed using the Weyuker’s nine properties to ensure the validity and correctness of the proposed metrics. The results demonstrate that the design driven complexity metrics satisfy by all Weyuker’s properties. An empirical evaluation is achieved by investigating correlations between the proposed design complexity metrics and other existing contemporary measures, such as code smells and technical debt. The second contribution is a set of mathematical formulas that calculates fuzzy metrics that adopts dynamic thresholds. These formulas enable an extensive empirical evaluation of these fuzzy metrics against data extracted from experts’ evaluations. This empirical study demonstrates that fuzzy metrics are significantly more aligned with human expert evaluators than existing methodologies. Developing accurate software quality frameworks can significantly improve how organizations manage their ever-increasing codebases, and can provide effective guidance to practitioners as they refactor and reengineer their software systems. vii TABLE OF CONTENTS ACKNOWLEDGEMENTS .....................................................................................................V ABSTRACT ........................................................................................................................... VI TABLE OF CONTENTS .....................................................................................................VIII LIST OF TABLES.............................................................................................................. XVII LIST OF FIGURES ...............................................................................................................XX CHAPTER 1: INTRODUCTION ............................................................................................ 1 1.1 BACKGROUND ........................................................................................................ 1 1.1.1 Software Quality ............................................................................................ 1 1.1.2 Software Sustainability .................................................................................. 2 1.1.3 Software Complexity ..................................................................................... 5 1.2 RESEARCH OBJECTIVES .......................................................................................... 6 1.3 PUBLICATIONS BASED ON THIS DISSERTATION ....................................................... 7 1.3.1 Comprehensive Model-Driven Complexity Metrics for Software [1] .......... 8 1.3.2 Code Complexity Metrics Derived from Software Design: A Framework and Theoretical Evaluation [4] ................................................................................................ 9 1.3.3 Metrics to Measure Code Complexity Based on Software Design: Practical Evaluation [10].................................................................................................................. 9 viii 1.3.4 Theoretically Validated Complexity Metrics for UML State Machines Models [3] 10 1.3.5 Towards a Model-Based Fuzzy Software Quality Metrics [6] ................... 10 1.3.6 Empirical Evaluation of Fuzzy Code Smells Methods with Expert Assessment [9] ................................................................................................................ 11 1.4 ORGANIZATION OF THIS DISSERTATION ................................................................ 11 1.4.1 Chapter 2: Related Works ........................................................................... 12 1.4.2 Chapter 3: Comprehensive Model-Driven Complexity Metrics for Software 12 1.4.3 Chapter 4: Code Complexity Metrics Derived from Software Design: A Framework and Theoretical Evaluation ......................................................................... 12 1.4.4 Chapter 5: Metrics to Measure Code Complexity Based on Software Design: Practical Evaluation ........................................................................................................ 13 1.4.5 Chapter 6: Theoretically Validated Complexity Metrics for UML State Machines Models ............................................................................................................ 13 1.4.6 Chapter 7: Towards A Model-Based Fuzzy Software Quality Metrics ...... 13 1.4.7 Chapter 8: Empirical Evaluation of Fuzzy Code Smells Methods with Expert Assessment 14 1.4.8 Chapter 9: Results and Main Findings ........................................................ 14 1.4.9 Chapter 10: Conclusion ............................................................................... 14 CHAPTER 2: RELATED WORKS ....................................................................................... 15 ix 2.1 COMPLEXITY METRICS FOR UML MODELS ......................................................... 15 2.1.1 Theoretical Validation of Complexity Metrics ........................................... 17 2.1.2 Complexity Metrics for UML Class Diagrams ........................................... 20 2.1.3 Complexity Metrics for UML State Machines Diagrams ........................... 25 2.2 CHARACTERIZATION OF CODE SMELLS ................................................................ 27 2.2.1 Code Smells Identification and Detection