Abstract
Constraint-based refactoring generalizes constraint-based type refactoring as introduced by Tip et al. [61] by extending the coverage of change from types to names, locations, accessibilities, and other properties of program elements. Starting with a generic specification of refactoring tools, we systematically develop constraint-based refactoring as a generic solution to a certain class of refactoring problems and provide a condition under which constraint-based refactoring tools are proven correct for any given target language. Although compliance with this correctness condition is hard to prove for target languages whose semantics is not formally defined, we show how the condition gives rise to automated testing procedures. We present a novel algorithm based on constraint-logic programming for the generation of constraints from a program to be refactored, and demonstrate its time and space requirements by using it in the application of refactorings to open source programs. Summarizing earlier work, we show how the principles underlying constraint-based refactoring tools extend to ad hoc refactoring, cross-language refactoring, and model/code co-refactoring.
- Chris Andreae, James Noble, Shane Markstrum, and Todd D. Millstein. 2006. A framework for implementing pluggable type systems. In Proceedings of the 21th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’06). ACM, New York, NY, 57--74. DOI:https://doi.org/10.1145/1167473.1167479 Google Scholar
Digital Library
- Ittai Balaban, Frank Tip, and Robert M. Fuhrer. 2005. Refactoring support for class library migration. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’05). ACM, New York, NY, 265--279. DOI:https://doi.org/10.1145/1094811.1094832 Google Scholar
Digital Library
- Fabian Bannwart and Peter Müller. 2006. Changing programs correctly: Refactoring with specifications. In FM 2006: Formal Methods. Lecture Notes in Computer Science, Vol. 4085. Springer, 492--507. DOI:https://doi.org/10.1007/11813040_33 Google Scholar
Digital Library
- Paulo Borba, Augusto Sampaio, Ana Cavalcanti, and Márcio Cornélio. 2004. Algebraic reasoning for object-oriented programming. Science of Computer Programming 52, 53--100. DOI:https://doi.org/10.1016/j.scico.2004.03.003 Google Scholar
Digital Library
- Alan Borning, Robert Duisberg, Bjørn N. Freeman-Benson, Axel Kramer, and Michael Woolf. 1987. Constraint hierarchies. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’87). ACM, New York, NY, 48--60. DOI:https://doi.org/10.1145/38765.38812 Google Scholar
Digital Library
- John Brant and Friedrich Steimann. 2015. Refactoring tools are trustworthy enough and trust must be earned. IEEE Software 32, 6, 80--83. DOI:https://doi.org/10.1109/MS.2015.145 Google Scholar
Digital Library
- Pascal Brisset, Hani El Sakkout, Thom Frühwirth, Carmen Gervet, Warwick Harvey, Micha Meier, Stefano Novello, Thierry Le Provost, Joachim Schimpf, Kish Shen, and Mark Wallace. 2016. ECLi PSe Constraint Library Manual. Cisco Systems Inc. http://eclipseclp.org/doc/libman.pdf.Google Scholar
- Randal E. Bryant and Miroslav N. Velev. 2002. Boolean satisfiability with transitivity constraints. ACM Transactions on Computational Logic 3, 4, 604--627. DOI:https://doi.org/10.1145/566385.566390 Google Scholar
Digital Library
- Brett Daniel, Danny Dig, Kely Garcia, and Darko Marinov. 2007. Automated testing of refactoring engines. In Proceedings of the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT International Symposium on Foundations of Software Engineering. ACM, New York, NY, 185--194. DOI:https://doi.org/10.1145/1287624.1287651 Google Scholar
Digital Library
- ECMA-367. 2006. Eiffel: Analysis, Design and Programming Language (2nd ed.). ECMA International. http://www.ecma-international.org/publications/standards/Ecma-367.htm.Google Scholar
- Stephen R. Foster, William G. Griswold, and Sorin Lerner. 2012. WitchDoctor: IDE support for real-time auto-completion of refactorings. In Proceedings of the 2012 34th International Conference on Software Engineering (ICSE’12). 222--232. DOI:https://doi.org/10.1109/ICSE.2012.6227191 Google Scholar
Cross Ref
- Martin Fowler. 1999. Refactoring—Improving the Design of Existing Code. Addison-Wesley. http://martinfowler.com/books/refactoring.html.Google Scholar
- Bjørn N. Freeman-Benson, John Maloney, and Alan Borning. 1990. An incremental constraint solver. Communications of the ACM 33, 1, 54--63. DOI:https://doi.org/10.1145/76372.77531 Google Scholar
Digital Library
- Robert M. Fuhrer, Frank Tip, Adam Kiezun, Julian Dolby, and Markus Keller. 2005. Efficiently refactoring Java applications to use generic libraries. In ECOOP 2005—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 3586. Springer, 71--96. DOI:https://doi.org/10.1007/11531142_4 Google Scholar
Digital Library
- Alejandra Garrido and Jose Meseguer. 2006. Formal specification and verification of Java refactorings. In Proceedings of the 6th IEEE International Workshop on Source Code Analysis and Manipulation (SCAM’06). IEEE, Los Alamitos, CA, 165--174. DOI:https://doi.org/10.1109/SCAM.2006.16 Google Scholar
Digital Library
- Xi Ge, Quinton L. DuBose, and Emerson R. Murphy-Hill. 2012. In Proceedings of the 2012 34th International Conference on Software Engineering (ICSE’12). 211--221. DOI:https://doi.org/10.1109/ICSE.2012.6227192 Google Scholar
Cross Ref
- Milos Gligoric, Farnaz Behrang, Yilong Li, Jeffrey Overbey, Munawar Hafiz, and Darko Marinov. 2013. Systematic testing of refactoring engines on real software projects. In ECOOP 2013—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 7920. Springer, 629--653. DOI:https://doi.org/10.1007/978-3-642-39038-8_26 Google Scholar
Digital Library
- James Gosling, Bill Joy, Guy L. Steele, Gilad Bracha, and Alex Buckley. 2014. The Java Language Specification, Java SE 8 Edition.Addison-Wesley Professional.Google Scholar
- William G. Griswold. 1991. Program Restructuring as an Aid to Software Maintenance. Ph.D. Dissertation. University of Washington.Google Scholar
Digital Library
- Christian Grothoff, Jens Palsberg, and Jan Vitek. 2007. Encapsulating objects with confined types. ACM Transactions on Programming Languages and Systems 29, 6, Article No. 32. DOI:https://doi.org/10.1145/1286821.1286823 Google Scholar
Digital Library
- Elnar Hajiyev, Mathieu Verbaere, and Oege de Moor. 2006. codeQuest: Scalable source code queries with datalog. In ECOOP 2006—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 4067. Springer, 2--27. DOI:https://doi.org/10.1007/11785477_2 Google Scholar
Digital Library
- Pascal Van Hentenryck. 1989. Constraint Satisfaction in Logic Programming. MIT Press, Cambridge, MA.Google Scholar
- Pascal Van Hentenryck and Laurent Michel. 2005. Constraint-Based Local Search. MIT Press, Cambridge, MA.Google Scholar
- C. A. R. Hoare. 1969. An axiomatic basis for computer programming. Communications of the ACM 12, 10, 576--580. DOI:https://doi.org/10.1145/363235.363259 Google Scholar
Digital Library
- Hannes Kegel and Friedrich Steimann. 2008. Systematically refactoring inheritance to delegation in Java. In Proceedings of the 30th International Conference on Software Engineering (ICSE’08). ACM, New York, NY, 431--440. DOI:https://doi.org/10.1145/1368088.1368147 Google Scholar
Digital Library
- Adam Kiezun, Michael D. Ernst, Frank Tip, and Robert M. Fuhrer. 2007. Refactoring for parameterizing Java classes. In Proceedings of the 29th International Conference on Software Engineering (ICSE’07). IEEE, Los Alamitos, CA, 437--446. DOI:https://doi.org/10.1109/ICSE.2007.70 Google Scholar
Digital Library
- Donald E. Knuth. 1968. Semantics of context-free languages. Mathematical Systems Theory 2, 2, 127--145. DOI:https://doi.org/10.1007/BF01692511 Google Scholar
Cross Ref
- Tiago Massoni, Rohit Gheyi, and Paulo Borba. 2006. An approach to invariant-based program refactoring. Electronic Communications of the EASST 3, 1--12. http://eceasst.cs.tu-berlin.de/index.php/eceasst/article/view/25.Google Scholar
- Tom Mens, Niels Van Eetvelde, Serge Demeyer, and Dirk Janssens. 2005. Formalizing refactorings with graph transformations. Journal of Software Maintenance 17, 4, 247--276. DOI:https://doi.org/10.1002/smr.316 Google Scholar
Digital Library
- Tom Mens and Tom Tourwé. 2004. A survey of software refactoring. IEEE Transactions on Software Engineering 30, 2, 126--139. DOI:https://doi.org/10.1109/TSE.2004.1265817 Google Scholar
Digital Library
- Marcus Mews. 2016. Kontrollflusssensible Quelltext-Umgestaltung mithilfe von Constraint-Programmierung (in German). Ph.D. Dissertation. Technische Universität Berlin. http://dx.doi.org/10.14279/depositonce-5444.Google Scholar
- Scott Meyers, Carolyn K. Duby, and Steven P. Reiss. 1993. Constraining the structure and style of object-oriented programs. In Proceedings of the 1st Workshop on Principles and Practice of Constraint Programming (PPCP’93). 200--209.Google Scholar
- Microsoft. 2003. C# Language Specification. Retrieved November 9, 2017, from http://www.microsoft.com/en-us/download/details.aspx?id=7029.Google Scholar
- OMG. 2012. About the Object Constraint Language Specification Version 2.4. Specification. Retrieved November 9, 2017, from http://www.omg.org/spec/OCL/.Google Scholar
- William F. Opdyke. 1992. Refactoring Object-Oriented Frameworks. Ph.D. Dissertation. University of Illinois at Urbana-Champaign.Google Scholar
Digital Library
- Jeffrey L. Overbye. 2011. A Toolkit for Constructing Refactoring Engines. Ph.D. Dissertation. University of Illinois at Urbana-Champaign.Google Scholar
- Jens Palsberg and Michael I. Schwartzbach. 1994. Object-Oriented Type Systems. Wiley.Google Scholar
- Veselin Raychev, Max Schäfer, Manu Sridharan, and Martin T. Vechev. 2013. Refactoring with synthesis. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’13). ACM, New York, NY, 339--354. DOI:https://doi.org/10.1145/2509136.2509544 Google Scholar
Digital Library
- Donald Bradley Roberts. 1999. Practical Analysis for Refactoring. Ph.D. Dissertation. University of Illinois at Urbana-Champaign.Google Scholar
- Max Schäfer. 2010. Specification, Implementation and Verification of Refactorings. Ph.D. Dissertation. Oxford University Computing Laboratory. http://progtools.comlab.ox.ac.uk/members/xiemaisi/thesis.Google Scholar
- Max Schäfer and Oege de Moor. 2010. Specifying and implementing refactorings. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’10). ACM, New York, NY, 286--301. DOI:https://doi.org/10.1145/1869459.1869485 Google Scholar
Digital Library
- Max Schäfer, Julian Dolby, Manu Sridharan, Emina Torlak, and Frank Tip. 2010. Correct refactoring of concurrent Java code. In ECOOP 2010—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 6183. Springer, 225--249. DOI:https://doi.org/10.1007/978-3-642-14107-2_11 Google Scholar
Cross Ref
- Max Schäfer, Torbjörn Ekman, and Oege de Moor. 2008. Sound and extensible renaming for Java. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’08). ACM, New York, NY, 277--294. DOI:https://doi.org/10.1145/1449764.1449787 Google Scholar
Digital Library
- Max Schäfer, Andreas Thies, Friedrich Steimann, and Frank Tip. 2012. A comprehensive approach to naming and accessibility in refactoring Java programs. IEEE Transactions on Software Engineering 38, 6, 1233--1257. DOI:https://doi.org/10.1109/TSE.2012.13 Google Scholar
Digital Library
- Max Schäfer, Mathieu Verbaere, Torbjörn Ekman, and Oege de Moor. 2009. Stepping stones over the refactoring rubicon In Proceedings of the 23rd European Conference on ECOOP2009—Object-Oriented Programming (ECOOP’09). 369--393. DOI:https://doi.org/10.1007/978-3-642-03013-0_17 Google Scholar
Digital Library
- Joachim Schimpf. 2002. Logical loops. In Logic Programming. Lecture Notes in Computer Science, Vol. 2401. Springer, 224--238. DOI:https://doi.org/10.1007/3-540-45619-8_16 Google Scholar
Cross Ref
- Gustavo Soares, Rohit Gheyi, and Tiago Massoni. 2013. Automated behavioral testing of refactoring engines. IEEE Transactions on Software Engineering 39, 2, 147--162. DOI:https://doi.org/10.1109/TSE.2012.19 Google Scholar
Digital Library
- Gustavo Soares, Melina Mongiovi, and Rohit Gheyi. 2011. Identifying overly strong conditions in refactoring implementations. In Proceedings of the IEEE 27th International Conference on Software Maintenance (ICSM’11). IEEE, Los Alamitos, CA, 173--182. DOI:https://doi.org/10.1109/ICSM.2011.6080784 Google Scholar
Digital Library
- Friedrich Steimann. 2015. From well-formedness to meaning preservation: Model refactoring for almost free. Software and System Modeling 14, 1, 307--320. DOI:https://doi.org/10.1007/s10270-013-0314-z Google Scholar
Digital Library
- Friedrich Steimann. 2015. Refactoring tools and their kin. In Grand Timely Topics in Software Engineering. Lecture Notes in Computer Science, Vol. 10223. Springer, 179--214. DOI:https://doi.org/10.1007/978-3-319-60074-1_8 Google Scholar
Cross Ref
- Friedrich Steimann, Jörg Hagemann, and Bastian Ulke. 2016. Computing repair alternatives for malformed programs using constraint attribute grammars. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’16). ACM, New York, NY, 711--730. DOI:https://doi.org/10.1145/2983990.2984007 Google Scholar
Digital Library
- Friedrich Steimann, Christian Kollee, and Jens von Pilgrim. 2011. A refactoring constraint language and its application to Eiffel. In ECOOP 2011—Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 6813. Springer, 255--280. DOI:https://doi.org/10.1007/978-3-642-22655-7_13 Google Scholar
Cross Ref
- Friedrich Steimann and Andreas Thies. 2009. From public to private to absent: Refactoring Java programs under constrained accessibility. In Genoa Proceedings of the 23rd European Conference on ECOOP 2009—Object-Oriented Programming (ECOOP’09). 419--443. DOI:https://doi.org/10.1007/978-3-642-03013-0_19 Google Scholar
Digital Library
- Friedrich Steimann and Jens von Pilgrim. 2012. Constraint-based refactoring with foresight. In ECOOP 2012--Object-Oriented Programming. Lecture Notes in Computer Science, Vol. 7313. Springer, 535--559. DOI:https://doi.org/10.1007/978-3-642-31057-7_24 Google Scholar
Digital Library
- Friedrich Steimann and Jens von Pilgrim. 2012. Refactorings without names. In Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE’12). ACM, New York, NY, 290--293. DOI:https://doi.org/10.1145/2351676.2351726 Google Scholar
Digital Library
- Nik Sultana and Simon J. Thompson. 2008. Mechanical verification of refactorings. In Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’08). ACM, New York, NY, 51--60. DOI:https://doi.org/10.1145/1328408.1328417 Google Scholar
Digital Library
- Andreas Thies. 2014. Constraintbasierte Refaktorisierung von Deklarationen in Java. Ph.D. Dissertation. Lehrgebiet Programmiersysteme, Fakultät für Mathematik und Informatik, FernUniversität in Hagen. https://ub-deposit.fernuni-hagen.de/receive/mir_mods_00000464.Google Scholar
- Andreas Thies and Eric Bodden. 2012. RefaFlex: Safer refactorings for reflective Java programs. In Proceedings of the International Symposium on Software Testing and Analysis (ISSTA’12). ACM, New York, NY, 1--11. DOI:https://doi.org/10.1145/2338965.2336754 Google Scholar
Digital Library
- Andreas Thies and Friedrich Steimann. 2010. Systematic testing of refactoring tools (poster). In Proceedings of the 5th Workshop on Automation of Software Test (AST’10). http://www.fernuni-hagen.de/ps/prjs/rtt/rtt_poster.pdf.Google Scholar
- Simon J. Thompson and Huiqing Li. 2013. Refactoring tools for functional languages. Journal of Functional Programming 23, 3, 293--350. DOI:https://doi.org/10.1017/S0956796813000117 Google Scholar
Cross Ref
- Frank Tip, Robert M. Fuhrer, Adam Kiezun, Michael D. Ernst, Ittai Balaban, and Bjorn De Sutter. 2011. Refactoring using type constraints. ACM Transactions on Programming Languages and Systems 33, 3, 9. DOI:https://doi.org/10.1145/1961204.1961205 Google Scholar
Digital Library
- Frank Tip, Adam Kiezun, and Dirk Bäumer. 2003. Refactoring for generalization using type constraints. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’03). ACM, New York, NY, 13--26. DOI:https://doi.org/10.1145/949305.949308 Google Scholar
Digital Library
- Bastian Ulke and Friedrich Steimann. 2013. OCL as a constraint generation language. In Proceedings of the MODELS 2013 OCL Workshop Co-Located With the 16th International ACM/IEEE Conference on Model Driven Engineering Languages and Systems (MODELS’13). CEUR Workshop Proceedings, Vol. 1092. 93--102. http://ceur-ws.org/Vol-1092/ulke.pdf.Google Scholar
- Bastian Ulke, Friedrich Steimann, and Ralf Lämmel. 2017. Partial evaluation of OCL expressions. In Proceedings of the ACM/IEEE 20th International Conference on Model Driven Engineering Languages and Systems. IEEE, Los Alamitos, CA.Google Scholar
Digital Library
- Mohsen Vakilian, Nicholas Chen, Stas Negara, Balaji Ambresh Rajkumar, Brian P. Bailey, and Ralph E. Johnson. 2012. Use, disuse, and misuse of automated refactorings. In Proceedings of the 34th International Conference on Software Engineering (ICSE’12). 233--243. DOI:https://doi.org/10.1109/ICSE.2012.6227190 Google Scholar
Cross Ref
- Mathieu Verbaere, Ran Ettinger, and Oege de Moor. 2006. JunGL: A scripting language for refactoring. In Proceedings of the 28th International Conference on Software Engineering (ICSE’06). ACM, New York, NY, 172--181. DOI:https://doi.org/10.1145/1134311Google Scholar
Digital Library
- Jens von Pilgrim, Bastian Ulke, Andreas Thies, and Friedrich Steimann. 2013. Model/code co-refactoring: An MDE approach. In Proceedings of the 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE’13). IEEE, Los Alamitos, CA, 682--687. DOI:https://doi.org/10.1109/ASE.2013.6693133 Google Scholar
Digital Library
Index Terms
Constraint-Based Refactoring
Recommendations
Refactoring of Crosscutting Concerns with Metaphor-Based Heuristics
It has been advocated that Aspect-Oriented Programming (AOP) is an effective technique to improve software maintainability through explicit support for modularising crosscutting concerns. However, in order to take the advantages of AOP, there is a need ...
Aspect-Oriented Refactoring of Legacy Applications: An Evaluation
The primary claimed benefits of aspect-oriented programming (AOP) are that it improves the understandability and maintainability of software applications by modularizing crosscutting concerns. Before there is widespread adoption of AOP, developers need ...
Role-based refactoring of crosscutting concerns
AOSD '05: Proceedings of the 4th international conference on Aspect-oriented software developmentImproving the structure of code can help developers work with a software system more efficiently and more consistently. To aid developers in re-structuring the implementation of crosscutting concerns using aspect-oriented programming, we introduce a ...






Comments