PUC-Rio Opus Research Group
This web page presents the supplementary material of the paper Removal of design problems through refactorings: are we looking at the right symptoms?.

Authors: Andre Eposhi, Willian Oizumi, Alessandro Garcia, Leonardo Sousa, Anderson Oliveira, Roberto Oliveira

Following sections present the complementary information regarding the paper.

A design problem is the result of design decisions that negatively impact quality attributes. For example, a stakeholder introduces a design problem when he decides to addresses multiple unrelated responsibilities in a single class, impacting the modifiability and reusability of the system. Given their negative consequences, design problems should be identified and refactored. The literature still lacks evidence on which symptoms' characteristics can be used as strong indicators of design problems. For example, it is unknown if the density and diversity of certain symptoms (e.g., violations of object-oriented principles) are correlated with the occurrence of design problems. Thus, in this paper, we report a case study involving two C# systems. We evaluated the impact of refactoring, focused on removing design problems, on the density and diversity of symptoms. Results indicate that refactored classes usually present higher density and diversity of symptoms. However, the density and diversity of some symptoms, such as the violation of object-oriented principles, was not predominantly higher in refactored classes. Moreover, contrary to our expectations, refactorings caused almost no positive impact on the density and diversity of symptoms.

The paper is available for download in the following link: [Download]

Quality Attribute

The ISO/IEC 25010 standard [20] provides a quality model, which specifies the characteristics that should be analyzed when evaluating software quality. This quality model is composed of eight main quality attributes: Functional Suitability, Efficiency, Compatibility, Usability, Reliability, Security, Maintainability, and Portability. Each quality attribute is subdivided into two or more sub-attributes. Compatibility, for example, is subdivided into co-existence and interoperability. Each quality attribute should be adequately addressed so that the software is able to meet the expectations of its stakeholders. In this work, we restricted our analyzes to the following quality attributes:

• Efficiency: Ability of the software to present appropriate performance, relative to: the amount of resources used, time behaviour, and capacity.

• Compatibility: Degree to which the software is able to exchange data with other software and/or function while sharing the same hardware or software environment.

• Reliability: Ability of the software to perform its responsibilities under specified conditions for a specified period of time.

• Maintainability: Software’s ability to be modified. Modifications may include software patches, enhancements, or adaptations due to changes in the environment and its functional requirements or specifications.

We focused on these quality attributes because they are the ones that appeared consistently in refactoring tasks of our target systems.


Design Problems

Design problems occur when stakeholders make decisions that negatively impact quality attributes [3]–[5]. Each design problem may impact one or more quality attributes. Due to the negative impact caused by design problems, software systems have often been discontinued or redesigned when they were allowed to persist [6]. Unmanaged Design Problems are design problems that exist but are neither tracked nor controlled throughout the evolution of the system. An unmanaged design problem occurs because stakeholders either are not aware of its existence or are unable to track and control it. Thus, in such cases, developers need to identify and to confirm the existence of a design problem. Next, we present an example to illustrate how quality attributes may be impacted by unmanaged design problems


Design Problem Symptoms

Sousa et al. [17] identified five types of symptom that developers frequently rely to identify design problems. Similarly to other related work [16], [21]–[23], they observed that developers tend to combine multiple symptoms, considering dimensions such as diversity and density to decide if there is a design problem or not. According to them, developers often combine two or more of the following symptom types: violation of non-functional requirements, incidence of code smells, misuse of design patterns, violation of quality requirements, and principle violations.


Refactoring

Refactoring consists in transforming the source code structure without changing the functional behaviour of the system [9], [10]. Thus, we consider that refactoring is any sequence of source code changes that is aimed at improving quality attributes of the system’s design.

Code Smells

Code smells are surface indicators of possible design problems [9]. This type of smell have been extensively investigated by different researchers (e.g. [11], [24]–[26]). Recent studies [16], [17], [21], [23] suggest that combining multiple code smells may improve the precision when identifying design problems. An example of code smell type is the God Class. This type of smell is used to identify classes that are long and excessively complex. We used a set of 11 categories of code smells, which are the following: Long Method, Complex Method, Long Parameter List, Long Identifier, Long Statement, Complex Conditional, Virtual Method Call from Constructor, Empty Catch Block, Magic Number, Duplicate Code, and Missing Default.


Principle Violations

In object-oriented systems, design problems usually impact object-oriented design characteristics, such as abstraction, encapsulation, modularity, and hierarchy. Therefore, the second symptom type we used is the principle violation. Principle violations are symptoms that may indicate the violation of object-oriented principles [12]. An example of object-oriented principle is the Single Responsibility Principle, which determines that each class should have a single responsibility in the system [12]. We detected 18 categories of principle violations: Imperative Abstraction, Unnecessary Abstraction, Multifaceted Abstraction, Unutilized Abstraction, Duplicate Abstraction, Deficient Encapsulation, Unexploited Encapsulation, Broken Modularization, Insufficient Modularization, Hublike Modularization, Cyclically-dependent Modularization, Wide Hierarchy, Deep Hierarchy, Multipath Hierarchy, Cyclic Hierarchy, Rebellious Hierarchy, Unfactored Hierarchy, and Missing Hierarchy.

A complete description of the Code Smells and Principle Violations used in this work is available at the Taxonomy of Software Smells website.


Violation of Quality Requirements

Quality requirements represent characteristics that are considered fundamental for software design. Examples of quality requirements are coupling, cohesion, and complexity. In this work, we opted for using coupling and complexity as representatives of this type of symptom. Coupling is a fundamental requirement that indicates the number of classes that a single class uses [27]. High coupling usually indicates the class contains one or more design problems. Cyclomatic Complexity, which we call here only by Complexity, is a property that measures the structural complexity of the code [28]. In a simplified way, the complexity of a class is determined by the number of decisions taken by its methods. High complexity usually indicates the class is difficult to maintain. We opted for not collecting cohesion, because the correct measurement of this quality requirement is still challenging.

Table I. Characteristics of Target Systems
Project Architectural Style Domain Size (KLOC) # of Commits
OpenPOS Layers Sales 97 3318
UniNFe Layers Invoice 492 2373
KLOC = Kilo Lines of Code

Refactoring Tasks



[1] J. Offutt, “Quality attributes of web software applications,” IEEE Softw., vol. 19, no. 2, pp. 25–32, Mar. 2002. [Online]. Available: https://doi.org/10.1109/52.991329

[2] I. Gorton, Essential software architecture. Springer Science & Business Media, 2006.

[3] Z. Li, P. Avgeriou, and P. Liang, “A systematic mapping study on technical debt and its management,” J. Syst. Softw., vol. 101, no. C, pp. 193–220, Mar. 2015. [Online]. Available: http://dx.doi.org/10.1016/j.jss.2014.12.027

[4] E. Lim, N. Taksande, and C. Seaman, “A balancing act: What software practitioners have to say about technical debt,” IEEE Software, vol. 29, no. 6, pp. 22–27, Nov 2012.

[5] T. Besker, A. Martini, and J. Bosch, “Time to pay up: Technical debt from a software quality perspective,” in Proceedings of the XX Iberoamerican Conference on Software Engineering, Buenos Aires, Argentina, May 22-23, 2017., 2017, pp. 235–248.

[6] A. MacCormack, J. Rusnak, and C. Baldwin, “Exploring the structure of complex software designs: An empirical study of open source and proprietary code,” Manage. Sci., vol. 52, no. 7, pp. 1015–1030, 2006.

[7] M. C. O. Silva, M. T. Valente, and R. Terra, “Does technical debt lead to the rejection of pull requests?” in Proceedings of the 12th Brazilian Symposium on Information Systems, ser. SBSI ’16, 2016, pp. 248–254.

[8] B. Curtis, J. Sappidi, and A. Szynkarski, “Estimating the size, cost, and types of technical debt,” in Proceedings of the Third International Workshop on Managing Technical Debt, ser. MTD ’12. Piscataway, NJ, USA: IEEE Press, 2012, pp. 49–53. [Online]. Available: http://dl.acm.org/citation.cfm?id=2666036.2666045

[9] M. Fowler, Refactoring: Improving the Design of Existing Code. Boston: Addison-Wesley Professional, 1999.

[10] E. J. Chikofsky and J. H. Cross, “Reverse engineering and design recovery: a taxonomy,” IEEE Software, vol. 7, no. 1, pp. 13–17, Jan 1990.

[11] E. Murphy-Hill and A. P. Black, “An interactive ambient visualization for code smells,” in Proceedings of the 5th international symposium on Software visualization; Salt Lake City, USA. ACM, 2010, pp. 5–14.

[12] R. C. Martin and M. Martin, Agile Principles, Patterns, and Practices in C# (Robert C. Martin). Upper Saddle River, NJ, USA: Prentice Hall PTR, 2006.

[13] E. Gamma, R. Helm, R. Johnson, and J. Vlissides, Design Patterns: Elements of Reusable Object-oriented Software. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc., 1995.

[14] M. Abbes, F. Khomh, Y. Gueheneuc, and G. Antoniol, “An empirical study of the impact of two antipatterns, blob and spaghetti code, on program comprehension,” in Proceedings of the 15th European Software Engineering Conference; Oldenburg, Germany, 2011, pp. 181–190.

[15] I. Macia, J. Garcia, D. Popescu, A. Garcia, N. Medvidovic, and A. von Staa, “Are automatically-detected code anomalies relevant to architectural modularity?: An exploratory analysis of evolving systems,” in AOSD ’12. New York, NY, USA: ACM, 2012, pp. 167–178.

[16] W. Oizumi, A. Garcia, L. Sousa, B. Cafeo, and Y. Zhao, “Code anomalies flock together: Exploring code anomaly agglomerations for locating design problems,” in The 38th International Conference on Software Engineering; USA, 2016.

[17] L. Sousa, A. Oliveira, W. Oizumi, S. Barbosa, A. Garcia, J. Lee, M. Kalinowski, R. de Mello, B. Fonseca, R. Oliveira, C. Lucena, and R. Paes, “Identifying design problems in the source code: A grounded theory,” in Proceedings of the 40th International Conference on Software Engineering, ser. ICSE ’18. New York, NY, USA: ACM, 2018, pp. 921– 931. [Online]. Available: http://doi.acm.org/10.1145/3180155.3180239

[18] S. Vidal, E. Guimaraes, W. Oizumi, A. Garcia, A. D. Pace, and C. Marcos, “Identifying architectural problems through prioritization of code smells,” in SBCARS16, Sept 2016, pp. 41–50.

[19] L. Sousa, R. Oliveira, A. Garcia, J. Lee, T. Conte, W. Oizumi, R. de Mello, A. Lopes, N. Valentim, E. Oliveira, and C. Lucena, “How do software developers identify design problems?: A qualitative analysis,” in Proceedings of 31st Brazilian Symposium on Software Engineering, ser. SBES’17, 2017.

[20] I. O. for Standardization, ISO-IEC 25010: 2011 Systems and Software Engineering-Systems and Software Quality Requirements and Evaluation (SQuaRE)-System and Software Quality Models. ISO, 2011.

[21] A. Yamashita, M. Zanoni, F. A. Fontana, and B. Walter, “Inter-smell relations in industrial and open source systems: A replication and comparative analysis,” in Software Maintenance and Evolution (ICSME), 2015 IEEE International Conference on, Sept 2015, pp. 121–130.

[22] I. Macia, R. Arcoverde, E. Cirilo, A. Garcia, and A. von Staa, “Supporting the identification of architecturally-relevant code anomalies,” in ICSM12, Sept 2012, pp. 662–665.

[23] W. Oizumi, L. Sousa, A. Oliveira, A. Garcia, A. B. Agbachi, R. Oliveira, and C. Lucena, “On the identification of design problems in stinky code: experiences and tool support,” Journal of the Brazilian Computer Society, vol. 24, no. 1, p. 13, Oct 2018. [Online]. Available: https://doi.org/10.1186/s13173-018-0078-y

[24] M. Lanza and R. Marinescu, Object-Oriented Metrics in Practice. Heidelberg: Springer, 2006.

[25] A. Yamashita and L. Moonen, “Do code smells reflect important maintainability aspects?” in ICSM12, 2012, pp. 306–315.

[26] N. Moha, Y. Gueheneuc, L. Duchien, and A. L. Meur, “Decor: A method for the specification and detection of code and design smells,” IEEE Transaction on Software Engineering, vol. 36, pp. 20–36, 2010.

[27] S. R. Chidamber and C. F. Kemerer, “A metrics suite for object oriented design,” IEEE Transactions on Software Engineering, vol. 20, no. 6, pp. 476–493, June 1994.

[28] T. J. McCabe, “A complexity measure,” IEEE Transactions on software Engineering, no. 4, pp. 308–320, 1976.

[29] E. Murphy-Hill and A. P. Black, “Seven habits of a highly effective smell detector,” in Proceedings of the 2008 International Workshop on Recommendation Systems for Software Engineering, ser. RSSE ’08. New York, NY, USA: ACM, 2008, pp. 36–40.

[30] D. M. Le, D. Link, A. Shahbazian, and N. Medvidovic, “An empirical study of architectural decay in open-source software,” in 2018 IEEE International Conference on Software Architecture (ICSA), April 2018, pp. 176–17 609.

[31] L. Xiao, Y. Cai, R. Kazman, R. Mo, and Q. Feng, “Identifying and quantifying architectural debt,” in Proceedings of the 38th International Conference on Software Engineering, ser. ICSE ’16. New York, NY, USA: ACM, 2016, pp. 488–498. [Online]. Available: http://doi.acm.org/10.1145/2884781.2884822

[32] Microsoft. (2019, February) Visual studio 2017 version 15.9 release notes. Available at https://docs.microsoft.com/pt-br/visualstudio/releasenotes/vs2017-relnotes.

[33] T. Sharma, P. Mishra, and R. Tiwari, “Designite: A software design quality assessment tool,” in Proceedings of the 1st International Workshop on Bringing Architectural Design Thinking into Developers’ Daily Activities, ser. BRIDGE ’16. New York, NY, USA: ACM, 2016, pp. 1–4. [Online]. Available: http://doi.acm.org/10.1145/2896935. 2896938

[34] T. R. Foundation. (2019, February) The r project for statistical computing. Available at https://www.r-project.org/.

[35] R. Mo, Y. Cai, R. Kazman, and L. Xiao, “Hotspot patterns: The formal definition and automatic detection of architecture smells,” in Software Architecture (WICSA), 2015 12th Working IEEE/IFIP Conference on, May 2015, pp. 51–60.

[36] I. Macia, R. Arcoverde, A. Garcia, C. Chavez, and A. von Staa, “On the relevance of code anomalies for identifying architecture degradation symptoms,” in CSMR12, March 2012, pp. 277–286.

[37] W. Oizumi, A. Garcia, T. Colanzi, A. Staa, and M. Ferreira, “On the relationship of code-anomaly agglomerations and architectural problems,” Journal of Software Engineering Research and Development, vol. 3, no. 1, pp. 1–22, 2015.

[38] M. Alenezi and M. Zarour, “An empirical study of bad smells during software evolution using designite tool,” i-Manager’s Journal on Software Engineering, vol. 12, no. 4, pp. 12–27, Apr 2018.

[39] G. Bavota, A. D. Lucia, M. D. Penta, R. Oliveto, and F. Palomba, “An experimental investigation on the innate relationship between quality and refactoring,” Journal of Systems and Software, vol. 107, pp. 1 – 14, 2015. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S0164121215001053

[40] A. Chavez, I. Ferreira, E. Fernandes, D. Cedrim, and A. Garcia, “How does refactoring affect internal quality attributes?: A multi-project study,” in Proceedings of the 31st Brazilian Symposium on Software Engineering, ser. SBES’17. New York, NY, USA: ACM, 2017, pp. 74–

83. [Online]. Available: http://doi.acm.org/10.1145/3131151.3131171

[41] D. Cedrim, A. Garcia, M. Mongiovi, R. Gheyi, L. Sousa, R. de Mello, B. Fonseca, M. Ribeiro, and A. Chavez, “Understanding the impact of refactoring on smells: A longitudinal study of 23 software projects,” in Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ser. ESEC/FSE 2017. New York, NY, USA: ACM, 2017, pp. 465–475. [Online]. Available: http://doi.acm.org/10.1145/3106237.3106259