Example-Based Program Transformation

  • Romain Robbes
  • Michele Lanza
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5301)


Software changes. During their life cycle, software systems experience a wide spectrum of changes, from minor modifications to major architectural shifts. Small-scale changes are usually performed with text editing and refactorings, while large-scale transformations require dedicated program transformation languages. For medium-scale transformations, both approaches have disadvantages. Manual modifications may require a myriad of similar yet not identical edits, leading to errors and omissions, while program transformation languages have a steep learning curve, and thus only pay off for large-scale transformations.

We present a system supporting example-based program transformation. To define a transformation, a programmer performs an example change manually, feeds it into our system, and generalizes it to other application contexts. With time, a developer can build a palette of reusable medium-sized code transformations. We provide a detailed description of our approach and illustrate it with examples.


Model Transformation Composite Change Code Block Change Factory Program Transformation 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Kerievsky, J.: Refactoring to Patterns. Pearson Higher Education, London (2004)Google Scholar
  2. 2.
    Robbes, R., Lanza, M.: Spyware: A change-aware development toolset. In: Proceedings of ICSE (30th International Conference in Software Engineering), pp. 847–850. ACM Press, New York (2008)Google Scholar
  3. 3.
    Robbes, R., Lanza, M.: A change-based approach to software evolution. Electronic Notes in Theoretical Computer Science (ENTCS) 166, 93–109 (2007)CrossRefGoogle Scholar
  4. 4.
    Robbes, R., Lanza, M.: Characterizing and understanding development sessions. In: Proceedings of ICPC (15th International Conference on Program Comprehension), pp. 155–164. IEEE Computer Soceity Press, Los Alamitos (2007)Google Scholar
  5. 5.
    Robbes, R., Lanza, M., Lungu, M.: An approach to software evolution based on semantic change. In: Dwyer, M.B., Lopes, A. (eds.) FASE 2007. LNCS, vol. 4422, pp. 27–41. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  6. 6.
    Lippe, E., van Oosterom, N.: Operation-based merging. In: SDE 5: Proceedings of the fifth ACM SIGSOFT symposium on Software development environments, pp. 78–87. ACM Press, New York (1992)CrossRefGoogle Scholar
  7. 7.
    Blanc, X., Mounier, I., Mougenot, A., Mens, T.: Detecting model inconsistency through operation-based model construction. In: Robby (ed.) ICSE, pp. 511–520. ACM, New York (2008)Google Scholar
  8. 8.
    Kögel, M.: Towards software configuration management for unified models. In: CVSM 2008: Proceedings of the 2008 international workshop on Comparison and versioning of software models, pp. 19–24. ACM, New York (2008)CrossRefGoogle Scholar
  9. 9.
    Baxter, I.D., Pidgeon, C., Mehlich, M.: Dms: Program transformations for practical scalable software evolution. In: ICSE, pp. 625–634. IEEE Computer Society, Los Alamitos (2004)Google Scholar
  10. 10.
    Akers, R.L., Baxter, I.D., Mehlich, M., Ellis, B.J., Luecke, K.R.: Reengineering c++ component models via automatic program transformation. In: WCRE, pp. 13–22. IEEE Computer Society, Los Alamitos (2005)Google Scholar
  11. 11.
    Visser, E.: Program transformation with Stratego/XT: Rules, strategies, tools, and systems in StrategoXT-0. In: Lengauer, C., Batory, D., Consel, C., Odersky, M. (eds.) Domain-Specific Program Generation. LNCS, vol. 3016, pp. 216–238. Springer, Heidelberg (2004)Google Scholar
  12. 12.
    Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 299–315. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  13. 13.
    Roover, C.D., D’Hondt, T., Brichau, J., Noguera, C., Duchien, L.: Behavioral similarity matching using concrete source code templates in logic queries. In: Ramalingam, G., Visser, E. (eds.) PEPM, pp. 92–101. ACM, New York (2007)Google Scholar
  14. 14.
    Boshernitsan, M., Graham, S.L., Hearst, M.A.: Aligning development tools with the way programmers think about code changes. In: Rosson, M.B., Gilmore, D.J. (eds.) CHI, pp. 567–576. ACM, New York (2007)Google Scholar
  15. 15.
    Opdyke, W.F.: Refactoring Object-Oriented Frameworks. Ph.D. thesis, University of Illinois (1992)Google Scholar
  16. 16.
    Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: Improving the Design of Existing Code. Addison Wesley, Reading (1999)Google Scholar
  17. 17.
    Roberts, D., Brant, J., Johnson, R.E., Opdyke, B.: An automated refactoring tool. In: Proceedings of ICAST 1996, Chicago, IL (1996)Google Scholar
  18. 18.
    Roberts, D., Brant, J.: Tools for making impossible changes - experiences with a tool for transforming large smalltalk programs. IEE Proceedings - Software 152(2), 49–56 (2004)CrossRefGoogle Scholar
  19. 19.
    Verbaere, M., Ettinger, R., de Moor, O.: Jungl: a scripting language for refactoring. In: Osterweil, L.J., Rombach, H.D., Soffa, M.L. (eds.) ICSE, pp. 172–181. ACM, New York (2006)CrossRefGoogle Scholar
  20. 20.
    Muller, P.A., Fleurey, F., Vojtisek, D., Drey, Z., Pollet, D., Fondement, F., Studer, P., Jézéquel, J.M.: On executable meta-languages applied to model transformations. In: Model Transformations In Practice Workshop (2005)Google Scholar
  21. 21.
    Jouault, F., Kurtev, I.: Transforming models with atl. In: Bruel, J.-M. (ed.) MoDELS 2005. LNCS, vol. 3844, pp. 128–138. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  22. 22.
    Varró, D.: Model transformation by example. In: Nierstrasz, O., Whittle, J., Harel, D., Reggio, G. (eds.) MoDELS 2006. LNCS, vol. 4199, pp. 410–424. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  23. 23.
    Wimmer, M., Strommer, M., Kargl, H., Kramler, G.: Towards model transformation generation by-example. System Sciences. In: 40th Annual Hawaii International Conference on HICSS 2007, p. 285 (January 2007)Google Scholar
  24. 24.
    Lieberman, H.: Your Wish Is My Command – Programming by Example. Morgan Kaufmann, San Francisco (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Romain Robbes
    • 1
  • Michele Lanza
    • 1
  1. 1.REVEAL @ Faculty of InformaticsUniversity of LuganoSwitzerland

Personalised recommendations