The Community for Technology Leaders
RSS Icon
Subscribe
Issue No.08 - Aug. (2013 vol.39)
pp: 1112-1126
Hui Liu , Beijing Institute of Technology, Beijing
Xue Guo , Beijing Institute of Technology, Beijing
Weizhong Shao , Peking University, Beijing
ABSTRACT
Software refactoring is an effective method for improvement of software quality while software external behavior remains unchanged. To facilitate software refactoring, a number of tools have been proposed for code smell detection and/or for automatic or semi-automatic refactoring. However, these tools are passive and human driven, thus making software refactoring dependent on developers' spontaneity. As a result, software engineers with little experience in software refactoring might miss a number of potential refactorings or may conduct refactorings later than expected. Few refactorings might result in poor software quality, and delayed refactorings may incur higher refactoring cost. To this end, we propose a monitor-based instant refactoring framework to drive inexperienced software engineers to conduct more refactorings promptly. Changes in the source code are instantly analyzed by a monitor running in the background. If these changes have the potential to introduce code smells, i.e., signs of potential problems in the code that might require refactorings, the monitor invokes corresponding smell detection tools and warns developers to resolve detected smells promptly. Feedback from developers, i.e., whether detected smells have been acknowledged and resolved, is consequently used to optimize smell detection algorithms. The proposed framework has been implemented, evaluated, and compared with the traditional human-driven refactoring tools. Evaluation results suggest that the proposed framework could drive inexperienced engineers to resolve more code smells (by an increase of 140 percent) promptly. The average lifespan of resolved smells was reduced by 92 percent. Results also suggest that the proposed framework could help developers to avoid similar code smells through timely warnings at the early stages of software development, thus reducing the total number of code smells by 51 percent.
INDEX TERMS
Software, Monitoring, Detection algorithms, Cloning, Detectors, Algorithm design and analysis, Inspection, instant refactoring, Software refactoring, code smell detection, monitor
CITATION
Hui Liu, Xue Guo, Weizhong Shao, "Monitor-Based Instant Software Refactoring", IEEE Transactions on Software Engineering, vol.39, no. 8, pp. 1112-1126, Aug. 2013, doi:10.1109/TSE.2013.4
REFERENCES
[1] T. Mens and T. Touwe, "A Survey of Software Refactoring," IEEE Trans. Software Eng., vol. 30, no. 2, pp. 126-139, Feb. 2004.
[2] W.F. Opdyke, "Refactoring Object-Oriented Frameworks," PhD dissertation, Univ. of Illinois at Urbana-Champaign, 1992.
[3] M. Fowler, K. Beck, J. Brant, W. Opdyke, and D. Roberts, Refactoring: Improving the Design of Existing Code. Addison Wesley Professional, 1999.
[4] R. Arnold, "An Introduction to Software Restructuring," Tutorial on Software Restructuring, R. Arnold, ed. IEEE CS Press, 1986.
[5] W.G. Griswold and D. Notkin, "Automated Assistance for Program Restructuring," ACM Trans. Software Eng. and Methodology, vol. 2, no. 3, pp. 228-269, July 1993.
[6] M. Kim, T. Zimmermann, and N. Nagappan, "A Field Study of Refactoring Challenges and Benefits," Proc. ACM SIGSOFT 20th Int'l Symp. Foundations of Software Eng., pp. 50:1-50:11, http://doi.acm.org/10.11452393596.2393655 , 2012.
[7] E. Mealy and P. Strooper, "Evaluating Software Refactoring Tool Support," Proc. Australian Software Eng. Conf., p. 10, Apr. 2006.
[8] Eclipse Foundation. Eclipse 3.4.2, http://www.eclipse.org/emftprojects/, 2013.
[9] R.M. Fuhrer, M. Keller, and A. Kiezun, "Advanced Refactoring in the Eclipse JDT: Past, Present, and Future," Proc. First Workshop Refactoring Tools in Conjunction with 21st European Conf. Object-Oriented Programming, D. Dig, ed., pp. 30-31, 2007.
[10] Microsoft Corporation, Microsoft Visual Studio 2008, http:/www.microsoft.com/, 2013.
[11] JetBrains Company, IntelliJ IDEA 8, http://www.jetbrains.comidea/, 2013.
[12] E. Mealy and P. Strooper, "Evaluating Software Refactoring Tool Support," Proc. Australian Software Eng. Conf., pp. 331-340, 2006.
[13] W.C. Wake, Refactoring Workbook. Addison Wesley, Aug. 2003.
[14] T. Kamiya, S. Kusumoto, and K. Inoue, "CCFinder: A Multi-Linguistic Token Based Code Clone Detection System for Large Scale Source Code," IEEE Trans. Software Eng., vol. 28, no. 6, pp. 654-670, July 2002.
[15] N. Tsantalis and A. Chatzigeorgiou, "Identification of Move Method Refactoring Opportunities," IEEE Trans. Software Eng., vol. 35, no. 3, pp. 347-367, May/June 2009.
[16] G. Bavota, A.D. Lucia, and R. Oliveto, "Identifying Extract Class Refactoring Opportunities Using Structural and Semantic Cohesion Measures," J. Systems and Software, vol. 84, no. 3, pp. 397-414, 2011.
[17] G. Bavota, R. Oliveto, A. De Lucia, G. Antoniol, and Y. Gueheneuc, "Playing with Refactoring: Identifying Extract Class Opportunities through Game Theory," Proc. IEEE Int'l Conf. Software Maintenance, pp. 1 -5, Sept. 2010.
[18] N. Tsantalis and A. Chatzigeorgiou, "Identification of Refactoring Opportunities Introducing Polymorphism," J. Systems and Software, vol. 83, no. 3, pp. 391-404, 2010.
[19] N. Moha, Y.-G. Gu´h´neuc, and L. P., "Automatic Generation of Detection Algorithms for Design Defects," Proc. 21st IEEE/ACM Int'l Conf. Automated Software Eng., pp. 297-300, Sept. 2006.
[20] N. Moha, Y.-G. Gu´h´neuc, L. Duchien, and L.M. A.-F., "Decor: A Method for the Specification and Detection of Code and Design Smells," IEEE Trans. Software Eng., vol. 36, no. 1, pp. 20-36, Jan./Feb. 2010.
[21] T. Tourwe and T. Mens, "Identifying Refactoring Opportunities Using Logic Meta Programming," Proc. Seventh European Conf. Software Maintenance and Reeng., pp. 91-100, 2003.
[22] B. Van Rompaey, B. Du Bois, S. Demeyer, and M. Rieger, "On the Detection of Test Smells: A Metrics-Based Approach for General Fixture and Eager Test," IEEE Trans. Software Eng., vol. 33, no. 12, pp. 800-817, Dec. 2007.
[23] M. Munro, "Product Metrics for Automatic Identification of 'Bad Smell' Design Problems in Java Source-Code," Proc. 11th IEEE Int'l Symp. Software Metrics, p. 15, Sept. 2005.
[24] E. Murphy-Hill, C. Parnin, and A.P. Black, "How We Refactor, and How We Know It," IEEE Trans. Software Eng., vol. 38, no. 1, pp. 5-18, Jan./Feb. 2012.
[25] M.A. Cusumano and R.W. Selby, Microsoft Secrets. Free Press, 1995.
[26] B.W. Boehm, "Seven Basic Principles of Software Engineering," J. Systems and Software, vol. 3, no. 1, pp. 3-24, Mar. 1983.
[27] E. Murphy-Hill and A.P. Black, "Refactoring Tools: Fitness for Purpose," IEEE Software, vol. 25, no. 5, pp. 38-44, Sept./Oct. 2008.
[28] G. Travassos, F. Shull, M. Fredericks, and V.R. Basili, "Detecting Defects in Object-Oriented Designs: Using Reading Techniques to Increase Software Quality," Proc. 14th ACM SIGPLAN Conf. Object-Oriented Programming, Systems, Languages, and Applications, pp. 47-56, http://doi.acm.org/10.1145320384.320389, 1999.
[29] B.S. Baker, "On Finding Duplication and Near-Duplication in Large Software Systems," Proc. Second IEEE Working Conf. Reverse Eng., pp. 86-95, July 1995.
[30] M. Balazinska, E. Merlo, M. Dagenais, B. Lague, and K. Kontogiannis, "Advanced Clone-Analysis to Support Object-Oriented System Refactoring," Proc. Seventh Working Conf. Reverse Eng., pp. 98-107, 2000.
[31] I. Baxter, A. Yahin, L. Moura, S. Anna, M., and L. Bier, "Clone Detection Using Abstract Syntax Trees," Proc. Int'l Conf. Software Maintenance, pp. 368-377, 1998.
[32] E. Burd and J. Bailey, "Evaluating Clone Detection Tools for Use During Preventative Maintenance," Proc. Second IEEE Int'l Workshop Source Code Analysis and Manipulation, pp. 36-43, Oct. 2002.
[33] S. Ducasse, M. Rieger, and S. Demeyer, "A Language Independent Approach for Detecting Duplicated Code," Proc. Int'l Conf. Software Maintenance, pp. 109-118, 1999.
[34] N. Tsantalis and A. Chatzigeorgiou, "Identification of Extract Method Refactoring Opportunities for the Decomposition of Methods," J. Systems Software, vol. 84, pp. 1757-1782, http://dx.doi.org/10.1016j.jss.2011.05.016 , Oct. 2011.
[35] R. Koschke, "Identifying and Removing Software Clones," Software Evolution, T. Mens and S. Demeyer, eds., pp. 15-36, Springer, 2008.
[36] R. Koschke, R. Falke, and P. Frenzel, "Clone Detection Using Abstract Syntax Suffix Trees," Proc. 13th Working Conf. Reverse Eng., pp. 253-262, 2006.
[37] H. Liu, Z. Ma, L. Zhang, and W. Shao, "Detecting Duplications in Sequence Diagrams Based on Suffix Trees," Proc. 13th Asia Pacific Software Eng. Conf., pp. 269-276, 2006.
[38] H. Liu, W. Shao, L. Zhang, and Z. Ma., "Detecting Overlapping Use Cases," IET Software (IEE Processing Software), vol. 1, no. 1, pp. 29-36, Feb. 2007.
[39] S. Bellon, R. Koschke, G. Antoniol, J. Krinke, and E. Merlo, "Comparison and Evaluation of Clone Detection Tools," IEEE Trans. Software Eng., vol. 33, no. 9, pp. 577-591, Sept. 2007.
[40] C.K. Roy, J.R. Cordy, and R. Koschke, "Comparison and Evaluation of Code Clone Detection Techniques and Tools: A Qualitative Approach," Science of Computer Programming, vol. 74, pp. 470-495, http://www.sciencedirect.com/science/article/ piiS0167642309000367, 2009.
[41] M. Zhang, T. Hall, and N. Baddoo, "Code Bad Smells: A Review of Current Knowledge," J. Software Maintenance and Evolution: Research and Practice, vol. 23, no. 3, pp. 179-202, http://dx.doi.org/10.1002smr.521, 2011.
[42] N. Gode and R. Koschke, "Incremental Clone Detection," Proc. European Conf. Software Maintenance and Reeng., pp. 219-228, 2009.
[43] B. Hummel, E. Juergens, L. Heinemann, and M. Conradt, "Index-Based Code Clone Detection: Incremental, Distributed, Scalable," Proc. IEEE Int'l Conf. Software Maintenance, pp. 1-9, Sept. 2010.
[44] H. Liu, Z. Ma, W. Shao, and Z. Niu, "Schedule of Bad Smell Detection and Resolution: A New Way to Save Effort," IEEE Trans. Software Eng., vol. 38, no. 1, pp. 220-235, Jan./Feb. 2012.
[45] B. Fluri, M. Wursch, M. Pinzger, and H. Gall, "Change Distilling: Tree Differencing for Fine-Grained Source Code Change Extraction," IEEE Trans. Software Eng., vol. 33, no. 11, pp. 725-743, Nov. 2007.
[46] R. Robbes and M. Lanza, "A Change-Based Approach to Software Evolution," Electronic Notes in Theoretical Computer Science, vol. 166, pp. 93-109, 2007.
[47] R. Lincke, J. Lundberg, and W. Löwe, "Comparing Software Metrics Tools," Proc. Int'l Symp. Software Testing and Analysis, pp. 131-142, http://doi.acm.org/10.11451390630.1390648 , 2008.
[48] E. Murphy-Hill, A.P. Black, D. Dig, and C. Parnin, "Gathering Refactoring Data: A Comparison of Four Methods," Proc. Second Workshop Refactoring Tools, pp. 7:1-7:5., http://doi.acm.org/10.11451636642.1636649 , 2008.
[49] B. Biegel and S. Diehl, "JCCD: A Flexible and Extensible API for Implementing Custom Code Clone Detectors," Proc. 25th IEEE/ACM Int'l Conf. Automated Software Eng., pp. 167-168, Sept. 2010.
[50] E. van Emden and L. Moonen, "Java Quality Assurance by Detecting Code Smells," Proc. Ninth Working Conf. Reverse Eng., pp. 97-108, 2002.
20 ms
(Ver 2.0)

Marketing Automation Platform Marketing Automation Tool