Identifying and Evaluating Software Architecture Erosion
Total Page:16
File Type:pdf, Size:1020Kb
SCUOLA DI DOTTORATO UNIVERSITÀ DEGLI STUDI DI MILANO-BICOCCA Department of Informatics Systems and Communication PhD program Computer Science Cycle XXX IDENTIFYING AND EVALUATING SOFTWARE ARCHITECTURE EROSION Surname Roveda Name Riccardo Registration number 723299 Tutor: Prof. Alberto Ottavio Leporati Supervisor: Prof. Francesca Arcelli Fontana Coordinator: Prof. Stefania Bandini ACADEMIC YEAR 2016/2017 CONTENTS 1 introduction1 1.1 Main contributions of the thesis . 2 1.2 Research Questions . 4 1.3 Publications . 5 1.3.1 Published papers . 5 1.3.2 Submitted papers . 6 1.3.3 To be submitted papers . 6 1.3.4 Published papers not strictly related to the thesis . 6 2 related work8 2.1 Architectural smells definitions . 8 2.2 Architectural smells detection . 19 2.3 Code smells and architectural smells correlations . 20 2.3.1 Code smells correlations . 20 2.3.2 Code smells and architectural smell correlations . 21 2.4 Studies on software quality prediction and evolution . 22 2.4.1 Studies on software quality prediction . 22 2.4.2 Studies on software quality evolution . 23 2.5 Technical Debt Indexes . 23 2.5.1 CAST . 24 2.5.2 inFusion . 25 2.5.3 Sonargraph . 26 2.5.4 SonarQube . 26 2.5.5 Structure101 .......................... 27 2.6 Architectural smell refactoring . 27 3 experience reports on the detection of architectu- ral issues through different tools 29 3.1 Tools for evaluating code and architectural issues . 29 3.2 Tool support for evaluating architectural debt . 31 3.2.1 Evaluating the results inspection of the tools . 32 3.2.2 Evaluating the extracted data by the tools . 35 3.3 Detecting and repairing software architecture erosion . 38 3.3.1 Detecting and Repairing Design Erosion with Sonar- graph . 39 3.3.2 Detecting and Repairing Design Erosion with Struc- ture101 ............................. 45 3.3.3 Discussion and Lessons Learned . 50 3.4 The impact evaluation of architectural problems refactoring . 52 3.4.1 Study Setup . 53 3.4.2 Results . 55 3.4.3 Observations on the results . 59 3.4.4 Threats of Validity . 59 3.5 Conclusions . 61 3.5.1 First Study of Section 3.2 .................. 61 contents iii 3.5.2 Second Study of Section 3.3 ................. 62 3.5.3 Third Study of Section 3.4 .................. 63 4 architectural smell detection through arcan 65 4.1 Architecture of Arcan . 65 4.2 Architectural Smells . 68 4.2.1 Cyclic Dependency (CD) . 68 4.2.2 Unstable Dependency (UD) . 69 4.2.3 Hub-Like Dependency (HL) . 70 4.2.4 Specification-Implementation Violation (SIV) . 71 4.2.5 Multiple Architectural Smell (MAS) . 72 4.2.6 Implicit Cross Package Dependency (ICPD) . 72 4.3 Conclusions . 74 5 evaluation and validation of arcan results 76 5.1 Initial evaluation of Arcan results . 76 5.1.1 Unstable Dependency Smell Results . 77 5.1.2 Hub-Like Results . 78 5.1.3 Cyclic Dependency Results . 80 5.1.4 Implicit Cross Package Dependency Results . 80 5.2 Architectural Smells Validation: An Industrial Case Study . 83 5.3 Architectural Smells Validation: A Mixed-Method Study . 85 5.3.1 Study Variables and Data Extraction . 86 5.3.2 Data Extracted to Answer the Research Questions . 89 5.3.3 Empirical Study Results . 89 5.3.4 Threats to Validity . 90 5.4 Conclusions . 91 6 empirical analysis with arcan 93 6.1 Architectural Smell Prediction and Evolution . 93 6.1.1 Definition and setup of the case study . 95 6.1.2 Results . 98 6.1.3 Threats to validity . 106 6.1.4 Conclusions . 107 6.2 Code smells and Architectural smells correlations . 108 6.2.1 Background . 109 6.2.2 Case Study Design . 112 6.2.3 Data Collection . 113 6.2.4 Data Analysis . 115 6.2.5 Results . 116 6.2.6 Discussion . 120 6.2.7 Lessons Learned . 123 6.2.8 Threads to Validity . 124 6.2.9 Conclusions . 125 7 proposal of a new architectural debt index 126 7.1 Discussion on the main TDI features . 126 7.2 A new Architectural Debt Index . 129 7.3 Which Index should be defined? . 129 7.4 An Architectural Debt Index . 131 7.4.1 ASIS . 132 contents iv 7.4.2 The ASIS evaluation . 134 7.4.3 History . 138 7.4.4 Architectural Debt Index evaluation . 139 7.4.5 Architectural Debt Index Profiles . 141 7.5 Conclusion . 142 8 architectural smells refactoring: a preliminary study144 8.1 Set up of the Study . 145 8.1.1 Analyzed Projects . 145 8.1.2 Data collection . 146 8.2 Architectural Smells Refactoring Results . 147 8.2.1 Refactoring Results of the Hub-Like Dependency (HL) smell . 149 8.2.2 Refactoring Results of the Unstable Dependency (UD) smell . 149 8.2.3 Refactoring Results of the Cyclic Dependency (CD) smell150 8.2.4 Refactoring Results of all the three AS . 151 8.2.5 Impact of Refactoring on Quality indexes . 152 8.3 Discussion . 152 8.3.1 Hints on how to refactor the AS . 152 8.3.2 Hints on how to improve the AS detection through Arcan153 8.3.3 Hints on which AS remove first . 154 8.4 Threats to Validity . 154 8.4.1 Threats to Internal Validity . 154 8.4.2 Threats to External Validity . 155 8.4.3 Threats to Conclusion Validity . 155 8.5 Conclusions Remarks . 155 9 conclusions and future developments 157 9.1 Conclusions . 157 9.2 Future Developments . 158 bibliography 161 a appendix2 a.1 The analyzed projects . 2 LISTOFFIGURES Figure 3.1 Sonargraph - package exploration view . 33 Figure 3.2 inFusion - SAP Breaker instance inspection . 34 Figure 3.3 Sonargraph - Cycles view . 36 Figure 3.4 SonarQube - dependency matrix among non-maven modules . 37 Figure 3.5 Sonargraph - Example of cycle to cut in the Cycles View on RepoFinder . 39 Figure 3.6 Sonargraph - Exploration view on RepoFinder . 40 Figure 3.7 Sonargraph - Architecture Violations in RepoFinder . 42 Figure 3.8 Structure101 - Structural over-complexity view on Ant 46 Figure 3.9 Structure101 - Exploration View on Ant . 46 Figure 3.10 Structure101 - Architecture Diagram of Ant . 47 Figure 3.11 S101 - Structural over-Complexity . 60 Figure 4.1 Arcan Architecture . 66 Figure 4.2 Example of Git history log . 67 Figure 4.3 Cycles shapes [2]...................... 69 Figure 4.4 Hub-Like Dependency smell example (on classes) . 71 Figure 4.5 Specific-Implementation Violation example . 72 Figure 4.6 Implicit Cross Package Dependency example . 73 Figure 5.1 Filtered Unstable Dependency Results . 78 Figure 5.2 Example of Junit Hub-Like class . 79 Figure 5.3 Commit of Tomcat by month and number of modified Java files . 81 Figure 5.4 Max ICPD of Tomcat by month . 81 Figure 5.5 Commit of JGit by month and number of modified Java files . 81 Figure 5.6 Max ICPD of JGit by month . 82 Figure 5.7 ICPD trend changes for Support and Strength in Tomcat 82 Figure 5.8 ICPD trend changes for Support and Strength in JGit . 83 Figure 5.9 Architecture Issues in the Dataset, a pie chart. 90 Figure 6.1 Evolution of architectural smells of Commons-Math by month . 104 Figure 6.2 Evolution of architectural smells of JGit by month . 105 Figure 6.3 Evolution of architectural smells of JUnit by month . 105 Figure 6.4 Evolution of architectural smells of Tomcat by month . 105 Figure 6.5 Data Collection Process . 114 Figure 6.6 Number of packages infected by code smells or archi- tectural smells . 117 Figure 6.7 Number of code smells and architectural smells per package . 118 Figure 7.1 ADI workflow . 131 Figure 7.2 Example of AS evolution . 138 list of figures vi Figure 7.3 Evolution of ADI by project . 139 Figure 8.1 Sonargraph indexes . 153 LISTOFTABLES Table 3.1 Tools feature overview . 30 Table 3.2 Sonargraph results overview . 36 Table 3.3 SonarQube results overview . 37 Table 3.4 Sonargraph - Extracted metrics . 40 Table 3.5 RepoFinder components definition patterns . 41 Table 3.6 Ant components definition patterns . 43 Table 3.7 Structure101 - Detected Tangles . 48 Table 3.8 Density of tangled and fat item in Ant . ..