Predicting move method refactoring opportunities in object-oriented code

Abstract Context Refactoring is the maintenance process of restructuring software source code to improve its quality without changing its external behavior. Move Method Refactoring (MMR) refers to moving a method from one class to the class in which the method is used the most often. Manually inspecting and analyzing the source code of the system under consideration to determine the methods in need of MMR is a costly and time-consuming process. Existing techniques for identifying MMR opportunities have several limitations, such as scalability problems and being inapplicable in early development stages. Most of these techniques do not consider semantic relationships. Objective We introduce a measure and a corresponding model to precisely predict whether a class includes methods in need of MMR. The measure is applicable once a class has entered the early development stages without waiting for other classes to be developed. Method The proposed measure considers both the cohesion and coupling aspects of methods. In addition, the measure uses structural and semantic data available within the class of interest. A statistical technique is applied to construct prediction models for classes that include methods in need of MMR. The models are applied on seven object-oriented systems to empirically evaluate their abilities to predict MMR opportunities. Results The results show both that the prediction models based on the proposed measure had outstanding prediction abilities and that the measure was able to correctly detect more than 90% of the methods in need of MMR within the predicted classes. Conclusions The proposed measure and corresponding prediction models are expected to greatly assist software engineers both in locating classes that include methods in need of MMR and in identifying these methods within the predicted classes.

[1]  Shinji Kusumoto,et al.  A metric-based approach to identifying refactoring opportunities for merging code clones in a Java software system , 2008 .

[2]  Ioannis Stamelos,et al.  Evaluating the Quality of Open Source Software , 2009, SQM@CSMR.

[3]  James M. Bieman,et al.  Cohesion and reuse in an object-oriented system , 1995, SSR '95.

[4]  Jing Liu,et al.  Class structure refactoring of object-oriented softwares using community detection in dependency networks , 2009, Frontiers of Computer Science in China.

[5]  S. Dumais Latent Semantic Analysis. , 2005 .

[6]  Istvan Gergely Czibula,et al.  Improving Systems Design Using a Clustering Approach , 2006 .

[7]  Ricardo Terra,et al.  Recommending Move Method refactorings using dependency sets , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[8]  Eduardo Kessler Piveta,et al.  Improving the search for refactoring opportunities on object-oriented and aspect-oriented software , 2009 .

[9]  Jehad Al Dallal Mathematical Validation of Object-Oriented Class Cohesion Metrics , 2010 .

[10]  Lionel C. Briand,et al.  A Precise Method-Method Interaction-Based Cohesion Metric for Object-Oriented Classes , 2012, TSEM.

[11]  Doo-Hwan Bae,et al.  Automated scheduling for clone‐based refactoring using a competent GA , 2011, Softw. Pract. Exp..

[12]  David L. Olson,et al.  Advanced Data Mining Techniques , 2008 .

[13]  Gabriele Bavota,et al.  When Does a Refactoring Induce Bugs? An Empirical Study , 2012, 2012 IEEE 12th International Working Conference on Source Code Analysis and Manipulation.

[14]  P. Rousseeuw,et al.  The Bagplot: A Bivariate Boxplot , 1999 .

[15]  Gabriele Bavota,et al.  Methodbook: Recommending Move Method Refactorings via Relational Topic Models , 2014, IEEE Transactions on Software Engineering.

[16]  Wei Li,et al.  Finding software metrics threshold values using ROC curves , 2010 .

[17]  Jing Wang,et al.  Identifying the move method refactoring opportunities based on evolutionary algorithm , 2013, Int. J. Model. Identif. Control..

[18]  Iman Hemati Moghadam,et al.  Automated Refactoring for Testability , 2011, 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation Workshops.

[19]  Gabriele Bavota,et al.  Improving software modularization via automated analysis of latent topics and dependencies , 2014, TSEM.

[20]  Michele Marchesi,et al.  Refactoring and its Relationship with Fan-in and Fan-out: An Empirical Study , 2012, 2012 16th European Conference on Software Maintenance and Reengineering.

[21]  Istvan Gergely Czibula,et al.  Hierarchical Clustering Based Automatic Refactorings Detection , 2008 .

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

[23]  G. Serban,et al.  Restructuring software systems using clustering , 2007, 2007 22nd international symposium on computer and information sciences.

[24]  Mark Harman,et al.  Experimental assessment of software metrics using automated refactoring , 2012, Proceedings of the 2012 ACM-IEEE International Symposium on Empirical Software Engineering and Measurement.

[25]  Anas Abdin,et al.  Empirical Evaluation of the Impact of Object-Oriented Code Refactoring on Quality Attributes: A Systematic Literature Review , 2018, IEEE Transactions on Software Engineering.

[26]  Jan Verelst,et al.  Refactoring - improving coupling and cohesion of existing code , 2004, 11th Working Conference on Reverse Engineering.

[27]  Martin Fowler,et al.  Refactoring - Improving the Design of Existing Code , 1999, Addison Wesley object technology series.

[28]  Mohammad Alshayeb,et al.  Software refactoring at the class level using clustering techniques , 2011 .

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

[30]  Jehad Al Dallal Identifying refactoring opportunities in object-oriented code: A systematic literature review , 2015, Inf. Softw. Technol..

[31]  Ioannis Stamelos,et al.  The SQO-OSS Quality Model: Measurement Based Open Source Software Evaluation , 2008, OSS.

[32]  D. Hosmer,et al.  Applied Logistic Regression , 1991 .

[33]  Gabriele Bavota,et al.  Identifying method friendships to remove the feature envy bad smell: NIER track , 2011, 2011 33rd International Conference on Software Engineering (ICSE).

[34]  Rudolf Ferenc,et al.  Using the Conceptual Cohesion of Classes for Fault Prediction in Object-Oriented Systems , 2008, IEEE Transactions on Software Engineering.

[35]  Romain Robbes,et al.  Linking e-mails and source code artifacts , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[36]  Lionel C. Briand,et al.  A Unified Framework for Cohesion Measurement in Object-Oriented Systems , 2004, Empirical Software Engineering.

[37]  Sandro Morasca,et al.  Defining and Validating Measures for Object-Based High-Level Design , 1999, IEEE Trans. Software Eng..

[38]  Johannes Stammel,et al.  Search-based determination of refactorings for improving the class structure of object-oriented systems , 2006, GECCO.

[39]  Jehad Al Dallal Constructing models for predicting extract subclass refactoring opportunities using object-oriented quality metrics , 2012, Inf. Softw. Technol..

[40]  Lionel C. Briand,et al.  An object-oriented high-level design-based class cohesion metric , 2010, Inf. Softw. Technol..

[41]  Lionel C. Briand,et al.  Replicated Case Studies for Investigating Quality Factors in Object-Oriented Designs , 2001, Empirical Software Engineering.