Skip to main content

Stepping Stones over the Refactoring Rubicon

Lightweight Language Extensions to Easily Realise Refactorings

  • Conference paper
Book cover ECOOP 2009 – Object-Oriented Programming (ECOOP 2009)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5653))

Included in the following conference series:

Abstract

Refactoring tools allow the programmer to pretend they are working with a richer language where the behaviour of a program is automatically preserved during restructuring. In this paper we show that this metaphor of an extended language yields a very general and useful implementation technique for refactorings: a refactoring is implemented by embedding the source program into an extended language on which the refactoring operations are easier to perform, and then translating the refactored program back into the original language. Using the well-known Extract Method refactoring as an example, we show that this approach allows a very fine-grained decomposition of the overall refactoring into a series of micro-refactorings that can be understood, implemented, and tested independently. We thus can easily write implementations of complex refactorings that rival and even outperform industrial strength refactoring tools in terms of correctness, but are much shorter and easier to understand.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight 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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Baxter, I.D., Yahin, A., Moura, L., Sant’Anna, M., Bier, L.: Clone Detection Using Abstract Syntax Trees. In: ICSM, Washington, DC, USA, p. 368. IEEE Computer Society Press, Los Alamitos (1998)

    Google Scholar 

  2. Eclipse (2008), http://www.eclipse.org

  3. Ekman, T., Ettinger, R., Schäfer, M., Verbaere, M.: Refactoring bugs (2008), http://progtools.comlab.ox.ac.uk/refactoring/bugreports

  4. Ekman, T., Hedin, G.: The JastAdd Extensible Java Compiler. In: OOPSLA (2007)

    Google Scholar 

  5. Ettinger, R.: Refactoring via Program Slicing and Sliding. D.Phil. thesis, Computing Laboratory, Oxford, UK (2007)

    Google Scholar 

  6. Ettinger, R., Verbaere, M.: Untangling: a slice extraction refactoring. In: Aspect-Oriented Software Development (AOSD), pp. 93–101 (2004)

    Google Scholar 

  7. Fowler, M.: Crossing Refactoring’s Rubicon (2001), http://martinfowler.com/articles/refactoringRubicon.html

  8. Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification (2005)

    Google Scholar 

  9. Griswold, W.G.: Program Restructuring as an Aid to Software Maintenance. Ph.D. thesis, University of Washington (1991)

    Google Scholar 

  10. IntelliJ IDEA (2008), http://www.jetbrains.com

  11. Johnsson, T.: Lambda Lifting: Transforming Programs to Recursive Equations. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 190–230. Springer, Heidelberg (1985)

    Chapter  Google Scholar 

  12. Juillerat, N., Hirsbrunner, B.: Improving Method Extraction: A Novel Approach to Data Flow Analysis Using Boolean Flags and Expressions. In: WRT (2007)

    Google Scholar 

  13. Kniesel, G., Koch, H.: Static Composition of Refactorings. The Science of Computer Programming 52(1-3), 9–51 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  14. Komondoor, R., Horwitz, S.: Semantics-preserving Procedure Extraction. In: POPL, pp. 155–169. ACM Press, New York (2000)

    Chapter  Google Scholar 

  15. Kuck, D.J., Kuhn, R.H., Leasure, B., Padua, D.A., Wolfe, M.: Dependence Graphs and Compiler Optimizations. In: POPL, January 1981, pp. 207–218 (1981)

    Google Scholar 

  16. Mens, T., DeMeyer, S., Janssens, D.: Formalising behaviour preserving program transformations. In: Corradini, A., Ehrig, H., Kreowski, H.-J., Rozenberg, G. (eds.) ICGT 2002. LNCS, vol. 2505, pp. 286–301. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  17. NetBeans (2008), http://www.netbeans.com

  18. Nilsson-Nyman, E., Ekman, T., Hedin, G., Magnusson, E.: Declarative Intraprocedural Flow Analysis of Java Source Code. In: Proceedings of 8th Workshop on Language Descriptions, Tools and Applications (LDTA 2008) (2008)

    Google Scholar 

  19. Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)

    Google Scholar 

  20. Perera, R.: Refactoring: to the Rubicon.. and beyond! In: OOPSLA 2004: Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, pp. 2–3. ACM Press, New York (2004)

    Chapter  Google Scholar 

  21. Schäfer, M., Ekman, T., de Moor, O.: Sound and Extensible Renaming for Java. In: Kiczales, G. (ed.) OOPSLA. ACM Press, New York (2008)

    Google Scholar 

  22. Schäfer, M., Ekman, T., de Moor, O.: Formalising and Verifying Reference Attribute Grammars in Coq. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 143–159. Springer, Heidelberg (2009)

    Google Scholar 

  23. Verbaere, M., Ettinger, R., de Moor, O.: JunGL: a Scripting Language for Refactoring. In: ICSE (2006)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Schäfer, M., Verbaere, M., Ekman, T., de Moor, O. (2009). Stepping Stones over the Refactoring Rubicon. In: Drossopoulou, S. (eds) ECOOP 2009 – Object-Oriented Programming. ECOOP 2009. Lecture Notes in Computer Science, vol 5653. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03013-0_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-03013-0_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-03012-3

  • Online ISBN: 978-3-642-03013-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics