Program Metamorphosis

  • Christoph Reichenbach
  • Devin Coughlin
  • Amer Diwan
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5653)


Modern development environments support refactoring by providing atomically behaviour-preserving transformations. While useful, these transformations are limited in three ways: (i) atomicity forces transformations to be complex and opaque, (ii) the behaviour preservation requirement disallows deliberate behaviour evolution, and (iii) atomicity limits code reuse opportunities for refactoring implementers.

We present ‘program metamorphosis’, a novel approach for program evolution and refactoring that addresses the above limitations by breaking refactorings into smaller steps that need not preserve behaviour individually. Instead, we ensure that sequences of transformations preserve behaviour together, and simultaneously permit selective behavioural change.

To evaluate program metamorphosis, we have implemented a prototype plugin for Eclipse. Our analysis and experiments show that (1) our plugin provides correctness guarantees on par with those of Eclipse’s own refactorings, (2) both our plugin and our approach address the aforementioned limitations, and (3) our approach fully subsumes traditional refactoring.


Refactoring Program Evolution 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Arsac, J.J.: Syntactic source to source transforms and program manipulation. Commun. ACM 22(1), 43–54 (1979)CrossRefzbMATHGoogle Scholar
  2. 2.
    Beck, K.: eXtreme Programming eXplained, Embrace Change. Addison-Wesley, Reading (2000)Google Scholar
  3. 3.
    Ferrante, J., Ottenstein, K.J., Warren, J.D.: The program dependence graph and its use in optimization. ACM Trans. Program. Lang. Syst. 9(3), 319–349 (1987)CrossRefzbMATHGoogle Scholar
  4. 4.
    Fowler, M., Beck, K., Brant, J., Opdyke, W., Roberts, D.: Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading (1999)Google Scholar
  5. 5.
    Griswold, W.G., Notkin, D.: Program Restructuring as an Aid to Software Maintenance. Technical report, Univ. of Wash (1990)Google Scholar
  6. 6.
    Kiezun, A., Fuhrer, R.M., Keller, M.: Advanced Refactoring in Eclipse: Past, Present and Future. In: First Workshop on Refactoring Tools, Berlin (2007),
  7. 7.
    Kniesel, G., Koch, H.: Static composition of refactorings. Sci. Comput. Program. 52(1-3), 9–51 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Li, H., Reinke, C., Thompson, S.: Tool Support for Refactoring Functional Programs. In: Jeuring, J. (ed.) ACM Sigplan Haskell Workshop, pp. 27–38 (2003)Google Scholar
  9. 9.
    Mens, T., Tourwe, T.: A survey of software refactoring. IEEE Trans. Softw. Eng. 30(2), 126–139 (2004)CrossRefGoogle Scholar
  10. 10.
    Mytkowicz, T., Sweeney, P.F., Hauswirth, M., Diwan, A.: Time interpolation: So many metrics, so few registers. In: MICRO 2007: Proceedings of the 40th Annual IEEE/ACM International Symposium on Microarchitecture, Washington, DC, USA, pp. 286–300. IEEE Computer Society Press, Los Alamitos (2007)Google Scholar
  11. 11.
    Reichenbach, C., Diwan, A.: Program Metamorphosis. Technical Report CU-CS-1036-07, University of Colorado at Boulder (2007)Google Scholar
  12. 12.
    Russell, S., Norvig, P.: Artificial Intelligence: A Modern Approach, 2nd edn. Prentice-Hall, Englewood Cliffs (2003)zbMATHGoogle Scholar
  13. 13.
    Schäfer, M., Ekman, T., de Moor, O.: Sound and Extensible Renaming for Java. In: Kiczales, G. (ed.) 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2008). ACM Press, New York (2008)Google Scholar
  14. 14.
    Shavor, S., D’Anjou, J., Fairbrother, S., Kehn, D., Kellerman, J., McCarthy, P.: The Java Developers Guide to Eclipse. Addison-Wesley, Reading (2003)Google Scholar
  15. 15.
    Taneja, K., Dig, D., Xie, T.: Automated detection of API refactorings in libraries. In: ASE 2007: Proceedings of the twenty-second IEEE/ACM international conference on Automated software engineering, pp. 377–380. ACM Press, New York (2007)Google Scholar
  16. 16.
    Wadler, P.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73, 344–358 (1990)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Ward, M.P., Zedan, H.: MetaWSL and Meta-Transformations in the FermaT Transformation System. In: COMPSAC (1), pp. 233–238 (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Christoph Reichenbach
    • 1
  • Devin Coughlin
    • 1
  • Amer Diwan
    • 1
  1. 1.University of ColoradoBoulderUSA

Personalised recommendations