Assessing the Refactoring of Brain Methods

Code smells are a popular mechanism for identifying structural design problems in software systems. Several tools have emerged to support the detection of code smells and propose some refactorings. However, existing tools do not guarantee that a smell will be automatically fixed by means of refactorings. This article presents Bandago, an automated approach to fix a specific type of code smell called Brain Method. A Brain Method centralizes the intelligence of a class and manifests itself as a long and complex method that is difficult to understand and maintain by developers. For each Brain Method, Bandago recommends several refactoring solutions to remove the smell using a search strategy based on simulated annealing. Our approach has been evaluated with several open-source Java applications, and the results show that Bandago can automatically fix more than 60% of Brain Methods. Furthermore, we conducted a survey with 35 industrial developers that showed evidence about the usefulness of the refactorings proposed by Bandago. Also, we compared the performance of the Bandago against that of a third-party refactoring tool.

[1]  Alessandro F. Garcia,et al.  JSpIRIT: a flexible tool for the analysis of code smells , 2015, 2015 34th International Conference of the Chilean Computer Science Society (SCCC).

[2]  Ricardo Terra,et al.  Recommending automated extract method refactorings , 2014, ICPC 2014.

[3]  Zhendong Niu,et al.  Identifying Fragments to be Extracted from Long Methods , 2009, 2009 16th Asia-Pacific Software Engineering Conference.

[4]  Stas Negara,et al.  Use, disuse, and misuse of automated refactorings , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[5]  E. Murphy-Hill,et al.  Breaking the barriers to successful refactoring , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[6]  Edgar N. Reyes,et al.  Optimization using simulated annealing , 1998, Northcon/98. Conference Proceedings (Cat. No.98CH36264).

[7]  Gabriele Bavota,et al.  Do They Really Smell Bad? A Study on Developers' Perception of Bad Code Smells , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[8]  Muhammad Ilyas,et al.  A Comparative Study on Code Smell Detection Tools , 2013 .

[9]  Andrew P. Black,et al.  Breaking the barriers to successful refactoring: observations and tools for extract method , 2008, ICSE.

[10]  Alexander Chatzigeorgiou,et al.  Identification of extract method refactoring opportunities for the decomposition of methods , 2011, J. Syst. Softw..

[11]  Radu Marinescu,et al.  InCode: Continuous Quality Assessment and Improvement , 2010, 2010 14th European Conference on Software Maintenance and Reengineering.

[12]  Francesca Arcelli Fontana,et al.  Towards a prioritization of code debt: A code smell Intensity Index , 2015, 2015 IEEE 7th International Workshop on Managing Technical Debt (MTD).

[13]  Yuanyuan Zhang,et al.  Search-based software engineering: Trends, techniques and applications , 2012, CSUR.

[14]  Ramanath Subramanyam,et al.  Empirical Analysis of CK Metrics for Object-Oriented Design Complexity: Implications for Software Defects , 2003, IEEE Trans. Software Eng..

[15]  E. Murphy-Hill,et al.  Refactoring Tools: Fitness for Purpose , 2006, IEEE Software.

[16]  Alexander Chatzigeorgiou,et al.  Ranking Refactoring Suggestions Based on Historical Volatility , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

[17]  Alessandro F. Garcia,et al.  On the criteria for prioritizing code anomalies to identify architectural problems , 2016, SAC.

[18]  Marouane Kessentini,et al.  A context-based refactoring recommendation approach using simulated annealing: two industrial case studies , 2017, GECCO.

[19]  Zhendong Niu,et al.  Schedule of Bad Smell Detection and Resolution: A New Way to Save Effort , 2012, IEEE Transactions on Software Engineering.

[20]  Mark Kent O'Keeffe,et al.  Search-based refactoring for software maintenance , 2008, J. Syst. Softw..

[21]  Yaghout Nourani,et al.  A comparison of simulated annealing cooling strategies , 1998 .

[22]  Ran Ettinger,et al.  Untangling: a slice extraction refactoring , 2004, AOSD '04.

[23]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[24]  Brian Henderson-Sellers,et al.  Object-Oriented Metrics , 1995, TOOLS.

[25]  Davood Mazinanian,et al.  Assessing the Refactorability of Software Clones , 2015, IEEE Transactions on Software Engineering.

[26]  Yann-Gaël Guéhéneuc,et al.  DECOR: A Method for the Specification and Detection of Code and Design Smells , 2010, IEEE Transactions on Software Engineering.

[27]  Mel Ó Cinnéide,et al.  Journal of Software Maintenance and Evolution: Research and Practice Search-based Refactoring: an Empirical Study , 2022 .

[28]  Mark Harman,et al.  Pareto optimal search based refactoring at the design level , 2007, GECCO '07.

[29]  Jing Li,et al.  The Qualitas Corpus: A Curated Collection of Java Code for Empirical Studies , 2010, 2010 Asia Pacific Software Engineering Conference.

[30]  Alexander Chatzigeorgiou,et al.  Identification of Move Method Refactoring Opportunities , 2009, IEEE Transactions on Software Engineering.

[31]  Miryung Kim,et al.  A field study of refactoring challenges and benefits , 2012, SIGSOFT FSE.

[32]  Andrew P. Black,et al.  How we refactor, and how we know it , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[33]  Chris F. Kemerer,et al.  A Metrics Suite for Object Oriented Design , 2015, IEEE Trans. Software Eng..

[34]  Scott Kirkpatrick,et al.  Optimization by simulated annealing: Quantitative studies , 1984 .

[35]  Ran Ettinger,et al.  Refactoring via Program Slicing and Sliding , 2007, ICSM.

[36]  Stéphane Ducasse,et al.  Object-Oriented Metrics in Practice , 2005 .

[37]  Michele Lanza,et al.  Object-Oriented Metrics in Practice - Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems , 2006 .

[38]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[39]  Claes Wohlin,et al.  Experimentation in software engineering: an introduction , 2000 .

[40]  Martin P. Robillard,et al.  Recommendation Systems for Software Engineering , 2010, IEEE Software.

[41]  Lefteris Angelis,et al.  Barriers to refactoring , 2017, Commun. ACM.

[42]  Kim Mens,et al.  Analyzing code evolution to uncover relations , 2015, 2015 IEEE 2nd International Workshop on Patterns Promotion and Anti-patterns Prevention (PPAP).

[43]  Francesca Arcelli Fontana,et al.  On experimenting refactoring tools to remove code smells , 2015, XP Workshops.

[44]  Panita Meananeatra,et al.  Using software metrics to select refactoring for long method bad smell , 2011, The 8th Electrical Engineering/ Electronics, Computer, Telecommunications and Information Technology (ECTI) Association of Thailand - Conference 2011.

[45]  A. Yamashita,et al.  Exploring the impact of inter-smell relations on software maintainability: An empirical study , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[46]  Claudia A. Marcos,et al.  An approach to prioritize code smells for refactoring , 2014, Automated Software Engineering.

[47]  Radu Marinescu,et al.  Assessing technical debt by identifying design flaws in software systems , 2012, IBM J. Res. Dev..

[48]  Steven Skiena,et al.  The Algorithm Design Manual , 2020, Texts in Computer Science.

[49]  Alessandro F. Garcia,et al.  Identifying Architectural Problems through Prioritization of Code Smells , 2016, 2016 X Brazilian Symposium on Software Components, Architectures and Reuse (SBCARS).

[50]  Iman Hemati Moghadam,et al.  Code-Imp: a tool for automated search-based refactoring , 2011, WRT '11.