Skip to main content

Recommending Program Transformations

Automating Repetitive Software Changes

  • Chapter
  • First Online:

Abstract

Adding features and fixing bugs in software often require systematic edits which are similar but not identical changes to multiple code locations. Finding all relevant locations and making the correct edits is a tedious and error-prone process. This chapter presents several state-of-the art approaches to recommending program transformation in order to automate repetitive software changes. First, it discusses programming-by-demonstration (PBD) approaches that automate repetitive tasks by inferring a generalized action script from a user’s recorded actions. Second, it presents edit location suggestion approaches that only recommend candidate edit locations but do not apply necessary code transformations. Finally, it describes program transformation approaches that take code examples or version histories as input, automatically identify candidate edit locations, and apply context awareness, customization program transformations to generate a new program version. In particular, this chapter describes two concrete example-based program transformation approaches in detail, Sydit and Lase. These two approaches are selected for an in-depth discussion, because they handle the issue of both recommending change locations and applying transformations, and they are specifically designed to update programs as opposed to regular text documents. The chapter is then concluded with open issues and challenges of recommending program transformations.

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

References

  1. Andersen, J.: Semantic patch inference. Ph.D. thesis, University of Copenhagen (2009)

    Google Scholar 

  2. Andersen, J., Lawall, J.L.: Generic patch inference. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 337–346 (2008). doi:10.1109/ASE.2008.44

    Google Scholar 

  3. Baxter, I.D., Pidgeon, C., Mehlich, M.: DMS: program transformations for practical scalable software evolution. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 625–634 (2004). doi:10.1109/ICSE.2004.1317484

    Google Scholar 

  4. Boshernitsan, M., Graham, S.L., Hearst, M.A.: Aligning development tools with the way programmers think about code changes. In: Proceedings of the ACM SIGCHI Conference on Human Factors in Computing Systems, pp. 567–576 (2007). doi:10.1145/1240624.1240715

    Google Scholar 

  5. Breu, S., Zimmermann, T.: Mining aspects from version history. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 221–230 (2006). doi:10.1109/ASE.2006.50

    Google Scholar 

  6. Canfora, G., Cerulo, L., Cimitile, M., Di Penta, M.: Social interactions around cross-system bug fixings: the case of FreeBSD and OpenBSD. In: Proceedings of the International Working Conference on Mining Software Repositories, pp. 143–152 (2011). doi:10.1145/1985441.1985463

    Google Scholar 

  7. Castro, S., Brichau, J., Mens, K.: Diagnosis and semi-automatic correction of detected design inconsistencies in source code. In: Proceedings of the International Workshop on Smalltalk Technologies, pp. 8–17 (2009). doi:10.1145/1735935.1735938

    Google Scholar 

  8. Cordy, J.R.: The TXL source transformation language. Sci. Comput. Program. 61(3), 190–210 (2006). doi:10.1016/j.scico.2006.04.002

    Article  MATH  MathSciNet  Google Scholar 

  9. De Volder, K.: JQuery: a generic code browser with a declarative configuration language. In: Hentenryck, P. (ed.) Practical Aspects of Declarative Languages. Lecture Notes in Computer Science, vol. 3819, pp. 88–102. Springer, Heidelberg (2006). doi:10.1007/11603023_7

    Chapter  Google Scholar 

  10. Duala-Ekoko, E., Robillard, M.P.: Clone region descriptors: representing and tracking duplication in source code. ACM T. Software Eng. Meth. 20(1), 3:1–3:31 (2010). doi:10.1145/1767751.1767754

    Google Scholar 

  11. Eaddy, M., Zimmermann, T., Sherwood, K.D., Garg, V., Murphy, G.C., Nagappan, N., Aho, A.V.: Do crosscutting concerns cause defects? IEEE T. Software Eng. 34(4), 497–515 (2008). doi:10.1109/TSE.2008.36

    Article  Google Scholar 

  12. Fluri, B., Würsch, M., Pinzger, M., Gall, H.C.: Change distilling: tree differencing for fine-grained source code change extraction. IEEE T. Software Eng. 33(11), 725–743 (2007). doi:10.1109/TSE.2007.70731

    Article  Google Scholar 

  13. Gulwani, S.: Dimensions in program synthesis. In: Proceedings of the ACM SIGPLAN International Symposium on Principles and Practice of Declarative Programming, pp. 13–24 (2010). doi:10.1145/1836089.1836091

    Google Scholar 

  14. Gulwani, S.: Automating string processing in spreadsheets using input–output examples. In: Proceedings of the ACM SIGPLAN Conference on Principles of Programming Languages, pp. 317–330 (2011). http://doi.acm.org/10.1145/1926385.1926423

  15. Gulwani, S., Korthikanti, V.A., Tiwari, A.: Synthesizing geometry constructions. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 50–61 (2011). http://doi.acm.org/10.1145/1993498.1993505

  16. Harris, W.R., Gulwani, S.: Spreadsheet table transformations from examples. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 317–328 (2011). doi:10.1145/1993498.1993536

    Google Scholar 

  17. Henkel, J., Diwan, A.: CatchUp!: capturing and replaying refactorings to support API evolution. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 274–283 (2005). doi:10.1145/1062455.1062512

    Google Scholar 

  18. Jacobellis, J., Meng, N., Kim, M.: LASE: an example-based program transformation tool for locating and applying systematic edits. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 1319–1322 (2013). doi:10.1109/ICSE.2013.6606707

    Google Scholar 

  19. Kapur, P., Cossette, B., Walker, R.J.: Refactoring references for library migration. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 726–738 (2010). doi:10.1145/1869459.1869518

    Google Scholar 

  20. Kellens, A., Mens, K., Tonella, P.: A survey of automated code-level aspect mining techniques. In: Rashid, A., Aksit, M. (eds.) Transactions on Aspect-Oriented Software Development IV. Lecture Notes in Computer Science, vol. 4640, pp. 143–162. Springer, Heidelberg (2007). doi:10.1007/978-3-540-77042-8_6

    Chapter  Google Scholar 

  21. Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J.M., Irwin, J.: Aspect-oriented programming. In: Proceedings of the European Conference on Object-Oriented Programming. Lecture Notes in Computer Science, vol. 1241, pp. 220–242 (1997). doi:10.1007/BFb0053381

    Google Scholar 

  22. Kim, M., Cai, D., Kim, S.: An empirical investigation into the role of API-level refactorings during software evolution. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 151–160 (2011). doi:10.1145/1985793.1985815

    Google Scholar 

  23. Kim, M., Notkin, D.: Discovering and representing systematic code changes. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 309–319 (2009). doi:10.1109/ICSE.2009.5070531

    Google Scholar 

  24. Kim, M., Sazawal, V., Notkin, D., Murphy, G.: An empirical study of code clone genealogies. In: Proceedings of the European Software Engineering Conference/ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 187–196 (2005). doi:10.1145/1081706.1081737

    Google Scholar 

  25. 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 

  26. Kim, S., Pan, K., Whitehead Jr., E.E.J.: Memories of bug fixes. In: Proceedings of the ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 35–45 (2006). doi:10.1145/1181775.1181781

    Google Scholar 

  27. Landauer, J., Hirakawa, M.: Visual AWK: a model for text processing by demonstration. In: Proceedings of the IEEE International Symposium on Visual Languages, pp. 267–274 (1995). doi:10.1109/VL.1995.520818

    Google Scholar 

  28. Lau, T., Wolfman, S.A., Domingos, P., Weld, D.S.: Learning repetitive text-editing procedures with SMARTedit. In: Lieberman, H. (ed.) Your Wish is My Command: Programming by Example, pp. 209–226. Morgan Kaufmann, Los Altos, CA (2001)

    Chapter  Google Scholar 

  29. Li, Z., Zhou, Y.: PR-Miner: automatically extracting implicit programming rules and detecting violations in large software code. In: Proceedings of the European Software Engineering Conference/ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 306–315 (2005). doi:10.1145/1081706.1081755

    Google Scholar 

  30. Lieberman, H. (ed.): Your Wish Is My Command: Programming by Example. Morgan Kaufmann, Los Altos, CA (2001)

    Google Scholar 

  31. Martin, M., Livshits, B., Lam, M.S.: Finding application errors and security flaws using PQL: a program query language. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 365–383 (2005). doi:10.1145/1094811.1094840

    Google Scholar 

  32. Masui, T., Nakayama, K.: Repeat and predict: two keys to efficient text editing. In: Proceedings of the ACM SIGCHI Conference on Human Factors in Computing Systems, pp. 118–130 (1994). doi:10.1145/191666.191722

    Google Scholar 

  33. Maulsby, D., Witten, I.H.: Cima: an interactive concept learning system for end-user applications. Appl. Artif. Intell.: Int. J. 11(7–8), 653–671 (1997). doi:10.1080/088395197117975

    Article  Google Scholar 

  34. McIntyre, M., Walker, R.J.: Assisting potentially-repetitive small-scale changes via semi-automated heuristic search. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 497–500 (2007). doi:10.1145/1321631.1321718

    Google Scholar 

  35. McIntyre, M.: Supporting repetitive small-scale changes. MSc thesis, University of Calgary (2007)

    Google Scholar 

  36. Meng, N., Kim, M., McKinley, K.S.: Sydit: creating and applying a program transformation from an example. In: Proceedings of the European Software Engineering Conference/ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 440–443 (2011a). doi:10.1145/2025113.2025185

    Google Scholar 

  37. Meng, N., Kim, M., McKinley, K.S.: Systematic editing: generating program transformations from an example. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 329–342 (2011b). doi:10.1145/1993498.1993537

    Google Scholar 

  38. Meng, N., Kim, M., McKinley, K.S.: LASE: locating and applying systematic edits by learning from examples. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 502–511 (2013). doi:10.1109/ICSE.2013.6606596

    Google Scholar 

  39. Mens, K., Lozano, A.: Source code based recommendation systems. In: Robillard, M., Maalej, W., Walker, R.J., Zimmermann, T. (eds.) Recommendation Systems in Software Engineering. Springer, Heidelberg, Chap. 5. (2014)

  40. Mens, K., Wuyts, R., D’Hondt, T.: Declaratively codifying software architectures using virtual software classifications. In: Proceedings of the International Conference on Technology of Object-Oriented Languages and Systems, pp. 33–45 (1999). doi:10.1109/TOOLS.1999.778997

    Google Scholar 

  41. Miller, R.C., Myers, B.A.: Interactive simultaneous editing of multiple text regions. In: Proceedings of the USENIX Annual Technical Conference, pp. 161–174 (2001)

    Google Scholar 

  42. Muşlu, K., Brun, Y., Holmes, R., Ernst, M.D., Notkin, D.: Speculative analysis of integrated development environment recommendations. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 669–682 (2012). doi:10.1145/2384616.2384665

    Google Scholar 

  43. 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 

  44. Nguyen, H.A., Nguyen, T.T., Wilson Jr., G., Nguyen, A.T., Kim, M., Nguyen, T.N.: A graph-based approach to API usage adaptation. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 302–321 (2010a). doi:10.1145/1869459.1869486

    Google Scholar 

  45. Nguyen, T.T., Nguyen, H.A., Pham, N.H., Al-Kofahi, J., Nguyen, T.N.: Recurring bug fixes in object-oriented programs. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 315–324 (2010b). doi:10.1145/1806799.1806847

    Google Scholar 

  46. Nguyen, T.T., Nguyen, H.A., Pham, N.H., Al-Kofahi, J.M., Nguyen, T.N.: Clone-aware configuration management. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 123–134 (2009). doi:10.1109/ASE.2009.90

    Google Scholar 

  47. Nix, R.: Editing by example. In: Proceedings of the ACM SIGPLAN Conference on Principles of Programming Languages, pp. 186–195 (1984). doi:10.1145/800017.800530

    Google Scholar 

  48. Padioleau, Y., Lawall, J., Hansen, R.R., Muller, G.: Documenting and automating collateral evolutions in Linux device drivers. In: Proceedings of the ACM SIGOPS/EuroSys European Conference on Computer Systems, pp. 247–260 (2008). doi:10.1145/1352592.1352618

    Google Scholar 

  49. Park, J., Kim, M., Ray, B., Bae, D.H.: An empirical study of supplementary bug fixes. In: Proceedings of the International Working Conference on Mining Software Repositories, pp. 40–49 (2012). doi:10.1109/MSR.2012.6224298

    Google Scholar 

  50. Perkins, J.H., Kim, S., Larsen, S., Amarasinghe, S., Bachrach, J., Carbin, M., Pacheco, C., Sherwood, F., Sidiroglou, S., Sullivan, G., Wong, W.F., Zibin, Y., Ernst, M.D., Rinard, M.: Automatically patching errors in deployed software. In: Proceedings of the ACM Symposium on Operating Systems Principles, pp. 87–102 (2009). doi:10.1145/1629575.1629585

    Google Scholar 

  51. Person, S., Dwyer, M.B., Elbaum, S., Păsăreanu, C.S.: Differential symbolic execution. In: Proceedings of the ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 226–237 (2008). doi:10.1145/1453101.1453131

    Google Scholar 

  52. Pollock, L.: Leveraging natural language analysis of software: achievements, challenges, and opportunities. In: Proceedings of the IEEE International Conference on Software Maintenance, p. 4 (2012). doi:10.1109/ICSM.2012.6405245

    Google Scholar 

  53. Purushothaman, R., Perry, D.E.: Toward understanding the rhetoric of small source code changes. IEEE T. Software Eng. 31(6), 511–526 (2005). doi:10.1109/TSE.2005.74

    Article  Google Scholar 

  54. Ray, B., Kim, M.: A case study of cross-system porting in forked projects. In: Proceedings of the European Software Engineering Conference/ACM SIGSOFT International Symposium on Foundations of Software Engineering, pp. 53:1–53:11 (2012). doi:10.1145/2393596.2393659

    Google Scholar 

  55. Robbes, R., Lanza, M.: Example-based program transformation. In: Proceedings of the International Conference on Model-Driven Engineering of Languages and Systems. Lecture Notes in Computer Science, vol. 5301, pp. 174–188 (2008). doi:10.1007/978-3-540-87875-9_13

    Google Scholar 

  56. Schaefer, M., de Moor, O.: Specifying and implementing refactorings. In: Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pp. 286–301 (2010). doi:10.1145/1869459.1869485

    Google Scholar 

  57. Shepherd, D., Fry, Z.P., Hill, E., Pollock, L., Vijay-Shanker, K.: Using natural language program analysis to locate and understand action-oriented concerns. In: Proceedings of the International Conference on Aspect-Oriented Software Deveopment, pp. 212–224 (2007). doi:10.1145/1218563.1218587

    Google Scholar 

  58. Solar-Lezama, A., Arnold, G., Tancau, L., Bodik, R., Saraswat, V., Seshia, S.: Sketching stencils. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 167–178 (2007). doi:10.1145/1250734.1250754

    Google Scholar 

  59. Tarr, P., Ossher, H., Harrison, W., Stanley M. Sutton, J.: N degrees of separation: multi-dimensional separation of concerns. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 107–119 (1999). doi:10.1145/302405.302457

    Google Scholar 

  60. Toomim, M., Begel, A., Graham, S.L.: Managing duplicated code with linked editing. In: Proceedings of the IEEE Symposium on Visual Languages and Human-Centric Computing, pp. 173–180 (2004). http://dx.doi.org/10.1109/VLHCC.2004.35

  61. 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)

  62. Wang, X., Lo, D., Cheng, J., Zhang, L., Mei, H., Yu, J.X.: Matching dependence-related queries in the system dependence graph. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering, pp. 457–466 (2010). doi:10.1145/1858996.1859091

    Google Scholar 

  63. Weimer, W., Nguyen, T., Le Goues, C., Forrest, S.: Automatically finding patches using genetic programming. In: Proceedings of the ACM/IEEE International Conference on Software Engineering, pp. 364–374 (2009). doi:10.1109/ICSE.2009.5070536

    Google Scholar 

  64. Weißgerber, P., Diehl, S.: Are refactorings less error-prone than other changes? In: Proceedings of the International Workshop on Mining Software Repositories, pp. 112–118 (2006). doi:10.1145/1137983.1138011

    Google Scholar 

  65. Witten, I.H., Mo, D.: TELS: Learning Text Editing Tasks from Examples, pp. 183–203. MIT, Cambridge, MA (1993)

    Google Scholar 

Download references

Acknowledgments

We thank Kathryn McKinley who contributed to designing and evaluating key algorithms of Sydit and Lase. We also thank her for our fruitful collaboration and numerous discussions on example-based program transformation approaches. We thank John Jacobellis who is a main contributor of developing the Lase Eclipse plugin. This work was supported in part by the National Science Foundation under grants CCF-1149391, CCF-1117902, SHF-0910818, and CCF-0811524 and by a Microsoft SEIF award.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Miryung Kim .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Kim, M., Meng, N. (2014). Recommending Program Transformations. 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_16

Download citation

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

  • 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