skip to main content
research-article

Specifying and implementing refactorings

Authors Info & Claims
Published:17 October 2010Publication History
Skip Abstract Section

Abstract

Modern IDEs for object-oriented languages like Java provide support for a basic set of simple automated refactorings whose behaviour is easy to describe intuitively. It is, however, surprisingly difficult to specify their behaviour in detail. In particular, the popular precondition-based approach tends to produce somewhat unwieldy descriptions if advanced features of the object language are taken into account. This has resulted in refactoring implementations that are complex, hard to understand, and even harder to maintain, yet these implementations themselves are the only precise "specification" of many refactorings. We have in past work advocated a different approach based on several complementary notions of dependencies that guide the implementation, and on the concept of microrefactorings that structure it. We show in this work that these concepts are powerful enough to provide high-level specifications of many of the refactorings implemented in Eclipse. These specifications are precise enough to serve as the basis of a clean-room reimplementation of these refactorings that is very compact, yet matches Eclipse's for features and outperforms it in terms of correctness.

References

  1. }}Umut A. Acar, Amal Ahmed, and Matthias Blume. Imperative Self-Adjusting Computation. In POPL, pages 309--322, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}John Boyland. Incremental Evaluators for Remote Attribute Grammars. Electr. Notes Theor. Comput. Sci., 65(3), 2002.Google ScholarGoogle Scholar
  3. }}Ittai Balaban, Frank Tip, and Robert Fuhrer. Refactoring support for class library migration. In OOPSLA, pages 265--279, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}A. Demers, T. Reps, and T. Teitelbaum. Incremental Evaluation for Attribute Grammars with Applications to Syntax-directed Editors. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 105--116. ACM Press, 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}Torbjörn Ekman and Görel Hedin. The JastAdd Extensible Java Compiler. In OOPSLA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}Torbjörn Ekman and Görel Hedin. The JastAdd system - modular extensible compiler construction. Sci. Comput. Program., 69(1-3):14--26, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}Eclipse Foundation. Eclipse 3.5. http://www.eclipse.org, 2010.Google ScholarGoogle Scholar
  8. }}Martin Fowler. Refactoring: improving the design of existing code. Addison Wesley, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}Alejandra Garrido and José Meseguer. Formal Specification and Verification of Java Refactorings. In SCAM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}William G. Griswold. Program Restructuring as an Aid to Software Maintenance. Ph.D. thesis, University of Washington, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}JetBrains. IntelliJ IDEA 9.0.1. http://www.jetbrains.com, 2010.Google ScholarGoogle Scholar
  12. }}Joshua Kerievsky. Refactoring to Patterns. Addison Wesley, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}Adam Kiezun, Michael D. Ernst, Frank Tip, and Robert M. Fuhrer. Refactoring for Parameterizing Java Classes. In ICSE, pages 437--446, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}Günter Kniesel and Helge Koch. Static Composition of Refactorings. The Science of Computer Programming, 52(1-3):9--51, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}Hannes Kegel and Friedrich Steimann. Systematically Refactoring Inheritance to Delegation in Java. In International Conference on Software Engineering (ICSE), pages 431--440. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}Ralf Lämmel. Towards Generic Refactoring. In Rule-based Programming (RULE), pages 15--28. ACM Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}William Harry Maddox. Incremental Static Semantic Analysis. Ph.D. thesis, University of California, Berkeley, 1997.Google ScholarGoogle Scholar
  18. }}William F. Opdyke. Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. }}Arnaud Payement. Type-based Refactoring using JunGL. Master's thesis, Oxford University Computing Laboratory, 2006.Google ScholarGoogle Scholar
  20. }}M. Pennings, D. Swierstra, and H. Vogt. Using cached functions and constructors for incremental attribute evaluation. In PLILP, pages 130--144. Springer Verlag, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}Max Schäfer and Oege de Moor. Of Gnats and Dragons -- Sources of Complexity in Implementing Refactorings. In WRT, 2009.Google ScholarGoogle Scholar
  22. }}Max Schäfer, Julian Dolby, Manu Sridharan, Frank Tip, and Emina Torlak. Correct Refactoring of Concurrent Java Code. In Theo D'Hondt, editor, ECOOP, 2010.Google ScholarGoogle ScholarCross RefCross Ref
  23. }}Max Schäfer, Torbjörn Ekman, and Oege de Moor. Sound and Extensible Renaming for Java. In Gregor Kiczales, editor, OOPSLA. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}Max Schäfer, Torbjörn Ekman, Ran Ettinger, and Mathieu Verbaere. Refactoring bugs. http://progtools.comlab.ox.ac.uk/projects/refactoring/bugreports, 2010.Google ScholarGoogle Scholar
  25. }}Quinten David Soetens. Formalizing Refactorings Implemented in Eclipse. Master's thesis, University of Antwerp, 2009.Google ScholarGoogle Scholar
  26. }}J. Saraiva, S. D. Swierstra, and M. F. Kuiper. Functional incremental attribute evaluation. In Compiler Construction, pages 279--294, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. }}Friedrich Steimann and Andreas Thies. From Public to Private to Absent: Refactoring Java Programs under Constrained Accessibility. In Sophia Drossopoulou, editor, ECOOP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. }}Max Schäfer, Mathieu Verbaere, Torbjörn Ekman, and Oege de Moor. Stepping Stones over the Refactoring Rubicon -- Lightweight Language Extensions to Easily Realise Refactorings. In Sophia Drossopoulou, editor, ECOOP, 2009.Google ScholarGoogle Scholar
  29. }}Frank Tip. Refactoring Using Type Constraints. In SAS, pages 1--17, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}Frank Tip, Adam Kiezun, and Dirk Bäumer. Refactoring for Generalization using Type Constraints. In OOPSLA, pages 13--26, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. }}Mathieu Verbaere, Ran Ettinger, and Oege de Moor. JunGL: a Scripting Language for Refactoring. In Dieter Rombach and Mary Lou Soffa, editors, International Conference on Software Engineering (ICSE), pages 172--181. ACM Press, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. }}Mathieu Verbaere. A Language to Script Refactoring Transformations. D.Phil. thesis, Oxford University Computing Laboratory, 2008.Google ScholarGoogle Scholar
  33. }}Jan Wloka, Manu Sridharan, and Frank Tip. Refactoring for Reentrancy. In ESEC/SIGSOFT FSE, pages 173--182, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Specifying and implementing refactorings

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 45, Issue 10
      OOPSLA '10
      October 2010
      957 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1932682
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
        October 2010
        984 pages
        ISBN:9781450302036
        DOI:10.1145/1869459

      Copyright © 2010 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 17 October 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!