Skip to main content

Recommending Refactoring Operations in Large Software Systems

  • Chapter
  • First Online:

Abstract

During its lifecycle, the internal structure of a software system undergoes continuous modifications. These changes push away the source code from its original design, often reducing its quality. In such cases, refactoring techniques can be applied to improve the readability and reducing the complexity of source code, to improve the architecture and provide for better software extensibility. Despite its advantages, performing refactoring in large and nontrivial software systems might be very challenging. Thus, a lot of effort has been devoted to the definition of automatic or semi-automatic approaches to support developer during software refactoring. Many of the proposed techniques are for recommending refactoring operations. In this chapter, we present guidelines on how to build such recommendation systems and how to evaluate them. We also highlight some of the challenges that exist in the field, pointing toward future research directions.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   129.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   169.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   169.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The main difference between code smells and anti-patterns is that a code smell represents something “probably wrong” in the code, while an anti-pattern is certainly a design problem in source code. In other words, a code smell might indicate an antipattern. As example, a Large Class (bad smell) is one of the symptoms of a Blob Class (antipattern).

  2. 2.

    Note that some of these approaches are also able to identify the design flaw besides suggesting how to solve it.

  3. 3.

    The only exception is represented by the approach proposed by Maruyama and Shima [44] that exploits historical information.

  4. 4.

    For more information on simulation techniques to evaluate recommendation systems, see Walker and Holmes [68] in Chap. 12.

References

  1. Abadi, A., Ettinger, R., Feldman, Y.A.: Fine slicing for advanced method extraction. In: Proceedings of the Workshop on Refactoring Tools (2009)

    Google Scholar 

  2. Abadi, A., Ettinger, R., Feldman, Y.A.: Fine slicing: theory and applications for computation extraction. In: Proceedings of the International Conference on Fundamental Approaches to Software Engineering. Lecture Notes in Computer Science, vol. 7212, pp. 471–485 (2012). doi:10.1007/978-3-642-28872-2_32?

    Google Scholar 

  3. Abdeen, H., Ducasse, S., Sahraoui, H.A., Alloui, I.: Automatic package coupling and cycle minimization. In: Proceedings of the Working Conference on Reverse Engineering, pp. 103–112 (2009). doi:10.1109/WCRE.2009.13

    Google Scholar 

  4. Abebe, S.L., Tonella, P.: Automated identifier completion and replacement. In: Proceedings of the European Conference on Software Maintenance and Reengineering, pp. 263–272 (2013). doi:10.1109/CSMR.2013.35

    Google Scholar 

  5. Atkinson, D.C., King, T.: Lightweight detection of program refactorings. In: Proceedings of the Asia–Pacific Software Engineering Conference, pp. 663–670 (2005). doi:10.1109/APSEC.2005.76

    Google Scholar 

  6. Baeza-Yates, R., Ribeiro-Neto, B.: Modern Information Retrieval. Addison-Wesley, Reading, MA (1999)

    Google Scholar 

  7. Basili, V.R., Briand, L., Melo, W.L.: A validation of object-oriented design metrics as quality indicators. IEEE T. Software Eng. 22(10), 751–761 (1995). doi:10.1109/32.544352

    Article  Google Scholar 

  8. Bavota, G., De Carluccio, B., De Lucia, A., Di Penta, M., Oliveto, R., Strollo, O.: When does a refactoring induce bugs?: an empirical study. In: Proceedings of the IEEE International Working Conference on Source Code Analysis and Manipulation, pp. 104–113 (2012a). doi:10.1109/SCAM.2012.20

    Google Scholar 

  9. Bavota, G., De Lucia, A., Marcus, A., Oliveto, R.: Automating extract class refactoring: an improved method and its evaluation. Empir. Software Eng. (2013a, in press). doi:10.1007/s10664-013-9256-x

    Google Scholar 

  10. Bavota, G., De Lucia, A., Marcus, A., Oliveto, R.: Using structural and semantic measures to improve software modularization. Empir. Software Eng. 18(5), 901–932 (2013b). doi:10.1007/s10664-012-9226-8?

    Article  Google Scholar 

  11. Bavota, G., De Lucia, A., Marcus, A., Oliveto, R., Palomba, F.: Supporting extract class refactoring in Eclipse: the ARIES project. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 1419–1422 (2012b). doi:10.1109/ICSE.2012.6227233

    Google Scholar 

  12. Bavota, G., De Lucia, A., Oliveto, R.: Identifying extract class refactoring opportunities using structural and semantic cohesion measures. J. Syst. Software 84(3), 397–414 (2011). doi:10.1016/j.jss.2010.11.918

    Article  Google Scholar 

  13. Bavota, G., Dit, B., Oliveto, R., Di Penta, M., Poshyvanyk, D., De Lucia, A.: An empirical study on the developers’ perception of software coupling. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 692–701 (2013c). doi:10.1109/ICSE.2013.6606615

    Google Scholar 

  14. Bavota, G., Gethers, M., Oliveto, R., Poshyvanyk, D., De Lucia, A.: Improving software modularization via automated analysis of latent topics and dependencies. ACM T. Software Eng. Meth. (2013d, in press)

    Google Scholar 

  15. Beck, K., Andres, C.: Extreme Programming Explained: Embrace Change. Addison-Wesley, Reading, MA (2004)

    Google Scholar 

  16. Binkley, A.B., Schach, S.R.: Validation of the coupling dependency metric as a predictor of run-time failures and maintenance measures. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 452–455 (1998). doi:10.1109/ICSE.1998.671604

    Google Scholar 

  17. Briand, L.C., Wuest, J., Lounis, H.: Using coupling measurement for impact analysis in object-oriented systems. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 475–482 (1999a). doi:10.1109/ICSM.1999.792645

    Google Scholar 

  18. Briand, L.C., Wüst, J., Ikonomovski, S.V., Lounis, H.: Investigating quality factors in object-oriented designs: an industrial case study. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 345–354 (1999b). doi:10.1145/302405.302654

    Google Scholar 

  19. Brown, W.J., Malveau, R.C., Brown, W.H., McCormick III, H.W., Mowbray, T.J.: Anti Patterns: Refactoring Software, Architectures, and Projects in Crisis. Wiley, New York (1998)

    Google Scholar 

  20. Chang, J., Blei, D.M.: Hierarchical relational models for document networks. Ann. Appl. Stat. 4(1), 124–150 (2010). doi:10.1214/09-AOAS309

    Article  MATH  MathSciNet  Google Scholar 

  21. Chidamber, S.R., Kemerer, C.F.: A metrics suite for object oriented design. IEEE T. Software Eng. 20(6), 476–493 (1994). doi:10.1109/32.295895

    Article  Google Scholar 

  22. Das, A.S., Datar, M., Garg, A., Rajaram, S.: Google news personalization: scalable online collaborative filtering. In: Proceedings of the International Conference on the World Wide Web, pp. 271–280 (2007). doi:10.1145/1242572.1242610

    Google Scholar 

  23. Deerwester, S., Dumais, S., Furnas, G., Landauer, T., Harshman, R.: Indexing by latent semantic analysis. J. Am. Soc. Inform. Sci. 41(6), 391–407 (1990). doi:10.1002/(SICI)1097-4571(199009)41:6⟨391::AID-ASI1⟩3.0.CO;2-9

    Article  Google Scholar 

  24. Du Bois, B., Demeyer, S., Verelst, J.: Refactoring: improving coupling and cohesion of existing code. In: Proceedings of the Working Conference on Reverse Engineering, pp. 144–151 (2004). doi:10.1109/WCRE.2004.33

    Google Scholar 

  25. Fokaefs, M., Tsantalis, N., Chatzigeorgiou, A., Sander, J.: Decomposing object-oriented class modules using an agglomerative clustering technique. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 93–101 (2009)

    Google Scholar 

  26. Fokaefs, M., Tsantalis, N., Stroulia, E., Chatzigeorgiou, A.: Identification and application of extract class refactorings in object-oriented systems. J. Syst. Software 85(10), 2241–2260 (2012). doi:10.1016/j.jss.2012.04.013

    Article  Google Scholar 

  27. Fowler, M.: Refactoring: improving the design of existing code. Addison-Wesley, Reading, MA (1999)

    Google Scholar 

  28. Gui, G., Scott, P.D.: Coupling and cohesion measures for evaluation of component reusability. In: Proceedings of the International Workshop on Mining Software Repositories, pp. 18–21 (2006). doi:10.1145/1137983.1137989

    Google Scholar 

  29. Gyimóthy, T., Ferenc, R., Siket, I.: Empirical validation of object-oriented metrics on open source software for fault prediction. IEEE T. Software Eng. 31(10), 897–910 (2005). doi:10.1109/TSE.2005.112

    Article  Google Scholar 

  30. Harman, M., Hierons, R.M., Proctor, M.: A new representation and crossover operator for search-based optimization of software modularization. In: Proceedings of the Genetic and Evolutionary Computation Conference, pp. 1351–1358 (2002)

    Google Scholar 

  31. Hartigan, J.A.: Clustering Algorithms. Wiley, New York (1975)

    MATH  Google Scholar 

  32. Kerievsky, J.: Refactoring to Patterns. Pearson, London (2004)

    Google Scholar 

  33. Khomh, F., Vaucher, S., Guéhéneuc, Y.G., Sahraoui, H.: BDTEX: a GQM-based Bayesian approach for the detection of antipatterns. J. Syst. Software 84(4), 559–572 (2011). doi:10.1016/j.jss.2010.11.921

    Article  Google Scholar 

  34. Kim, M., Zimmermann, T., Nagappan, N.: A field study of refactoring challenges and benefits. In: Proceedings of the ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 50:1–50:11 (2012). doi:10.1145/2393596.2393655

    Google Scholar 

  35. Lanza, M., Marinescu, R.: Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems. Springer, Berlin (2006). doi:10.1007/3-540-39538-5

    Google Scholar 

  36. Lawrie, D., Morrell, C., Feild, H., Binkley, D.: Effective identifier names for comprehension and memory. Innov. Syst. Software Eng. 3(4), 303–318 (2007). doi:10.1007/s11334-007-0031-2?

    Article  Google Scholar 

  37. Lee, Y.S., Liang, B.S., Wu, S.F., Wang, F.J.: Measuring the coupling and cohesion of an object-oriented program based on information flow. In: Proceedings of the International Conference on Software Quality, pp. 81–90 (1995)

    Google Scholar 

  38. Li, W., Henry, S.: Maintenance metrics for the object oriented paradigm. In: Proceedings of the International Software Metrics Symposium, pp. 52–60 (1993). doi:10.1109/METRIC.1993.263801

    Google Scholar 

  39. Liu, Y., Poshyvanyk, D., Ferenc, R., Gyimóthy, T., Chrisochoides, N.: Modeling class cohesion as mixtures of latent topics. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 233–242 (2009). doi:10.1109/ICSM.2009.5306318

    Google Scholar 

  40. Mancoridis, S., Mitchell, B.S., Rorres, C., Chen, Y.F., Gansner, E.R.: Using automatic clustering to produce high-level system organizations of source code. In: Proceedings of the IEEE International Workshop on Program Comprehenension, pp. 45–52 (1998). doi:10.1109/WPC.1998.693283

    Google Scholar 

  41. Marcus, A., Poshyvanyk, D., Ferenc, R.: Using the conceptual cohesion of classes for fault prediction in object-oriented systems. IEEE T. Software Eng. 34(2), 287–300 (2008). doi:10.1109/TSE.2007.70768

    Article  Google Scholar 

  42. Marinescu, R.: Detection strategies: metrics-based rules for detecting design flaws. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 350–359 (2004). doi:10.1109/ICSM.2004.1357820

    Google Scholar 

  43. Martin, R.C. (ed.): Clean Code: A Handbook of Agile Software Craftsmanship. Prentice Hall, Upper Saddle River (2009)

    Google Scholar 

  44. Maruyama, K., Shima, K.: Automatic method refactoring using weighted dependence graphs. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 236–245 (1999). doi:10.1145/302405.302627

    Google Scholar 

  45. Mens, T., Tourwe, T.: A survey of software refactoring. IEEE T. Software Eng. 30(2), 126–139 (2004). doi:10.1109/TSE.2004.1265817

    Article  Google Scholar 

  46. Mens, T., Van Eetvelde, N., Demeyer, S., Janssens, D.: Formalizing refactorings with graph transformations. J. Software Maint. Evol. R. 17(4), 247–276 (2005). doi:10.1002/smr.316

    Article  Google Scholar 

  47. Mitchell, B.S., Mancoridis, S.: On the automatic modularization of software systems using the Bunch tool. IEEE T. Software Eng. 32(3), 193–208 (2006). doi:10.1109/TSE.2006.31

    Article  Google Scholar 

  48. Moha, N., Guéhéneuc, Y.G., Duchien, L., Le Meur, A.F.: DECOR: a method for the specification and detection of code and design smells. IEEE T. Software Eng. 36(1), 20–36 (2010). doi:10.1109/TSE.2009.50

    Article  Google Scholar 

  49. Murphy-Hill, E., Parnin, C., Black, A.P.: How we refactor, and how we know it. IEEE T. Software Eng. 38(1), 5–18 (2011). doi:10.1109/TSE.2011.41

    Article  Google Scholar 

  50. Nierstrasz, O., Ducasse, S., Demeyer, S.: Object-Oriented Reengineering Patterns. Morgan Kaufmann, San Francisco (2003)

    MATH  Google Scholar 

  51. O’Keeffe, M., Ó Cinnéide, M.: Search-based software maintenance. In: Proceedings of the European Conference on Software Maintenance and Reengineering, pp. 249–260 (2006). doi:10.1109/CSMR.2006.49

    Google Scholar 

  52. Oliveto, R., Gethers, M., Bavota, G., Poshyvanyk, D., De Lucia, A.: Identifying method friendships to remove the feature envy bad smell. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 820–823 (2011). doi:10.1145/1985793.1985913

    Google Scholar 

  53. Oppenheim, A.N.: Questionnaire Design, Interviewing and Attitude Measurement. Pinter, New York(1992)

    Google Scholar 

  54. Overbey, J.L., Johnson, R.E.: Differential precondition checking: a lightweight, reusable analysis for refactoring tools. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 303–312 (2011). doi:10.1109/ASE.2011.6100067

    Google Scholar 

  55. Poshyvanyk, D., Marcus, A., Ferenc, R., Gyimóthy, T.: Using information retrieval based coupling measures for impact analysis. Empir. Software Eng. 14(1), 5–32 (2009). doi:10.1007/s10664-008-9088-2?

    Article  Google Scholar 

  56. Praditwong, K., Harman, M., Yao, X.: Software module clustering as a multi-objective search problem. IEEE T. Software Eng. 37(2), 264–282 (2011). doi:10.1109/TSE.2010.26

    Article  Google Scholar 

  57. Prete, K., Rachatasumrit, N., Sudan, N., Kim, M.: Template-based reconstruction of complex refactorings. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 1–10 (2010). doi:10.1109/ICSM.2010.5609577

    Google Scholar 

  58. Rao, A.A., Reddy, K.N.: Detecting bad smells in object oriented design using design change propagation probability matrix. In: Proceedings of the International MultiConference of Engineers and Computer Scientists. Lecture Notes in Engineering and Computer Science, pp. 1001–1007 (2008)

    Google Scholar 

  59. Reichenbach, C., Coughlin, D., Diwan, A.: Program metamorphosis. In: Proceedings of the European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 5653, pp. 394–418 (2009). doi:10.1007/978-3-642-03013-0_18

    Google Scholar 

  60. Rousseeuw, P.J.: Silhouettes: a graphical aid to the interpretation and validation of cluster analysis. J. Comput. Appl. Math. 20, 53–65 (1987). doi:10.1016/0377-0427(87)90125-7

    Article  MATH  Google Scholar 

  61. Schäfer, M., Verbaere, M., Ekman, T., de Moor, O.: Stepping stones over the refactoring Rubicon. In: Proceedings of the European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 5653, pp. 369–393 (2009). doi:10.1007/978-3-642-03013-0_17

    Google Scholar 

  62. Seng, O., Stammel, J., Burkhart, D.: Search-based determination of refactorings for improving the class structure of object-oriented systems. In: Proceedings of the Genetic and Evolutionary Computation Conference, pp. 1909–1916 (2006). doi:10.1145/1143997.1144315

    Google Scholar 

  63. Simon, F., Steinbrückner, F., Lewerentz, C.: Metrics based refactoring. In: Proceedings of the European Conference on Software Maintenance and Reengineering, pp. 30–38 (2001). doi:10.1109/.2001.914965

    Google Scholar 

  64. Thulasiraman, K., Swamy, M.N.S.: Graphs: Theory and Algorithms. Wiley, New York (1992)

    Book  MATH  Google Scholar 

  65. Travassos, G., Shull, F., Fredericks, M., Basili, V.R.: Detecting defects in object-oriented designs: using reading techniques to increase software quality. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 47–56 (1999). doi:10.1145/320384.320389

    Google Scholar 

  66. Tsantalis, N., Chatzigeorgiou, A.: Identification of move method refactoring opportunities. IEEE T. Software Eng. 35, 347–367 (2009). doi:10.1109/TSE.2009.1

    Article  Google Scholar 

  67. Tsantalis, N., Chatzigeorgiou, A.: Identification of extract method refactoring opportunities for the decomposition of methods. J. Syst. Software 84(10), 1757–1782 (2011). doi:10.1016/j.jss.2011.05.016

    Article  Google Scholar 

  68. Walker, R.J., Holmes, R.: Simulation: a methodology to evaluate recommendation systems in software engineering. In: Robillard, M., Maalej, W., Walker, R.J., Zimmermann, T. (eds.) Recommendation Systems in Software Engineering, Springer, Heidelberg, Chap. 12 (2014)

  69. Weiser, M.: Program slicing. IEEE T. Software Eng. 10(4), 352–357 (1984). doi:10.1109/TSE.1984.5010248

    Article  MATH  Google Scholar 

  70. Wen, Z., Tzerpos, V.: An effectiveness measure for software clustering algorithms. In: Proceedings of the IEEE International Workshop on Program Comprehenension, pp. 194–203 (2004). doi:10.1109/WPC.2004.1311061

    Google Scholar 

  71. Wu, J., Hassan, A.E., Holt, R.C.: Comparison of clustering algorithms in the context of software evolution. In: Proceedings of the IEEE International Conference on Software Maintenance, pp. 525–535 (2005). doi:10.1109/ICSM.2005.31

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gabriele Bavota .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Bavota, G., De Lucia, A., Marcus, A., Oliveto, R. (2014). Recommending Refactoring Operations in Large Software Systems. In: Robillard, M., Maalej, W., Walker, R., Zimmermann, T. (eds) Recommendation Systems in Software Engineering. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-45135-5_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-45135-5_15

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-45134-8

  • Online ISBN: 978-3-642-45135-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics