Automated Software Engineering

, Volume 23, Issue 1, pp 77–104 | Cite as

Differential precondition checking: a language-independent, reusable analysis for refactoring engines

  • Jeffrey L. OverbeyEmail author
  • Ralph E. Johnson
  • Munawar Hafiz


One of the most difficult parts of building automated refactorings is ensuring that they preserve behavior. This paper proposes a new technique to check for behavior preservation; we call this technique differential precondition checking. It is simple yet expressive enough to implement the most common refactorings, and the core algorithm runs in linear time. However, the main advantage is that a differential precondition checker can be placed in a library and reused in refactoring tools for many different languages; the core algorithm can be implemented in a way that is completely language independent. We have implemented a differential precondition checker and used it in refactoring tools for Fortran (Photran), PHP, and BC.


Precondition checking Refactoring Restructuring Static analysis 



This research is part of the Blue Waters sustained-petascale computing project, which is supported by the National Science Foundation (Award Number OCI 07-25070) and the state of Illinois. Blue Waters is a joint effort of the University of Illinois at Urbana-Champaign, its National Center for Supercomputing Applications, IBM, and the Great Lakes Consortium for Petascale Computation. Additionally, portions of this research were supported by the National Science Foundation under award CCF-1217271. The authors would like to thank the anonymous reviewers, as well as Rob Bocchino, John Brant, Brett Daniel, Danny Dig, Matthew Fotzler, Milos Gligoric, Vilas Jagannath, Ashley Kasza, Darko Marinov, Stas Negara, and members of the Brett Daniel Software Engineering Seminar for providing invaluable feedback on earlier drafts of this paper.


  1. Daniel, B., Dig, D., Garcia, K., Marinov, D.: Automated testing of refactoring engines. In: Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on the Foundations of Software Engineering (FSE ’07). ACM, New York, (2007)Google Scholar
  2. Dig, D., Marrero, J., Ernst, M.D.: Refactoring sequential Java code for concurrency via concurrent libraries. In: Proceedings of the 31st International Conference on Software Engineering. IEEE Computer Society (ICSE ’09), Washington, DC, pp. 397–407 (2009)Google Scholar
  3. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading, MA (1995)Google Scholar
  4. Kennedy, Ken, Allen, John R.: Optimizing Compilers for Modern Architectures: A Dependence-Based Approach. Morgan Kaufmann, San Francisco (2002)Google Scholar
  5. Mens, Tom, van Eetvelde, N., Demeyer, S., Janssens, D.: Formalizing Refactorings with Graph Transformations. J. Softw. Maint. Evol. 17(4), 247–276 (2005)CrossRefGoogle Scholar
  6. Murphy-Hill, E., Parnin, C., Black, A.P..: How we refactor, and how we know it. In: Proceedings of the 31st International Conference on Software Engineering (ICSE ’09), pp. 287–297 (2009)Google Scholar
  7. Overbey, J.L., Fotzler, M.J., Kasza, A.J., Johnson, R.E.: A Collection of Refactoring Specifications for Fortran 95, BC, and PHP 5. Technical Report (2011)
  8. Overbey, J.L., Johnson, R.E.: Differential precondition checking: a lightweight, reusable analysis for refactoring tools. In: 26th IEEE/ACM International Conference on Automated Software Engineering (ASE ’11), pp. 303–312. Lawrence (2011)Google Scholar
  9. Overbey, J.L., Johnson, R.E.: Generating rewritable abstract syntax trees. In: Software Language Engineering. Lecture Notes in Computer Science, vol. 5452, pp. 114–133. Springer, Berlin (2008)Google Scholar
  10. Reichenbach, C., Coughlin, D., Diwan, A.: Program metamorphosis. In: Proceedings of the 23rd European Conference on Object Oriented Programming (ECOOP ’09) (2009)Google Scholar
  11. Schäfer, M., de Moor, O.: Specifying and implementing refactorings. In: ACM Sigplan Notices (SPLASH ’10), vol. 45, pp. 286–301 (2010)Google Scholar
  12. Schäfer, M., Dolby, J., Sridharan, M., Tip, F., Torlak, E.: Correct refactoring of concurrent Java code. In: 24th European Conference on Object-Oriented Programming (ECOOP ’10). Springer, Berlin (2010)Google Scholar
  13. Schäfer, M., Ekman, T., de Moor, O.: Sound and extensible renaming for Java. In: 23rd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA ’08). ACM Press, New York (2008)Google Scholar
  14. Schäfer, M., Verbaere, M., Ekman, T., de Moor, O.: Stepping stones over the refactoring rubicon—lightweight language extensions to easily realise refactorings. In: ECOOP ’09 (2009)Google Scholar
  15. Verbaere, M., Ettinger, R., de Moor, O.: JunGL: a scripting language for refactoring. In: Proceedings of the 28th International Conference on Software Engineering (ICSE’06). ACM, New York (2006)Google Scholar

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Jeffrey L. Overbey
    • 1
    Email author
  • Ralph E. Johnson
    • 2
  • Munawar Hafiz
    • 1
  1. 1.Department of Computer Science and Software EngineeringAuburn UniversityAuburnUSA
  2. 2.Department of Computer ScienceUniversity of Illinois at Urbana-ChampaignChampaignUSA

Personalised recommendations