Abstract
This paper presents a refactoring tool for C++. Its implementation illustrates the main difficulties of automated refactoring raising in this case from the preprocessor and from the complexity of the language. Our solution, using a back-mapping preprocessor, works in the presence of complex preprocessor constructions built upon file inclusions, macro expansions and conditional compilations. Refactorings are computed after full preprocessing and parsing of target programs, hence, they are based on the same level of program understanding as performed by compilers. The paper illustrates the main ideas of our approach on the example of Extract Method refactoring.3.
This work was supported by Agency for Promotion Research and Development under the contract No. APVV-20-P04805.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Eclipse. http://www.eclipse.org.
Ref++. http://www.refpp.com.
Visual slickedit. http://www.slickedit.com.
Ira D. Baxter and Michael Mehlich. Preprocessor conditional removal by simple partial evaluation. In Proceedings of WCRE 2001: Working Conference on Reverse Engineering, Stuttgart, Germany, 2001. IEEE Computer Society Press.
Kent Beck. Extreme Programming explained. Reading, MA, Addison Wesley Longman, Inc., 107108., 2000.
Anthony Cox and Charles Clarke. Relocating xml elements from preprocessed to unprocessed code. In Proceedings of IWPC 2002: International Workshop on Program Comprehension, Paris, France, 2002.
D.G. Waddington and B. Yao. High fidelity C++ code transformation. In Proceedings of the 5th workshop on Language Descriptions, Tools and Applications (LDTA 2005), Edinburgh University, UK, 2005.
R. Fanta and V. Rajlich. Reengineering an object oriented code. In Procceedings of IEEE International Conference On Software Maintenance, pages 238–246, 1999.
Martin Fowler, (with contributions by K. Beck, J. Brant, W. Opdyke, and D. Roberts). Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999.
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1994.
A. Garrido and R. Johnson. Analyzing multiple configurations of a c program. In Procceedings of IEEE International Conference On Software Maintenance, Budapest, Hungary, 2005.
Alejandra Garrido, Program Refactoring in the Presence of Preprocessor Directives. PhD thesis, University of Illinois, Urbana-Champaign, IL, USA, 2005.
Alejandra Garrido and Ralph Johnson. Refactoring c with conditional compilation. In 18th IEEE International Conference on Automated Software Engineering, Montreal, Canada, 2003.
Richard Garzaniti, Jim Huangs, and Chet Hendrickson. Everything i need to know i learned from the chrysler payroll project. In Conference Addendum to the Proceedings of OOPSLA’97, 1997.
Ralph E. Johnson and Brian Foote. Designing reusable classes. Journal of Object-Oriented Programming, 1(2):22–25, July 1988.
M. Latendresse. Fast symbolic evaluation of c/c++ preprocessing using conditional values. In Procceedings of the seventh European Conference on Software Maintenance and Reengineering, Benevento, Italy, pages 170–182, 2003.
Bill McCloskey and Eric Brewer. Astec: A new approach to c refactoring. ACM SIGSOFT Software Engineering Notes, 30(5), Sep 2005.
P. E. Moreau, C. Ringeissen, and M. Vittek, A pattern matching compiler for multiple target languages. In International Conference on Compiler Construction, Varsovie, Pologne, volume 2622 of Lecture Notes in Computer Science, pages 61–76, 2003.
William F. Opdyke. Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois, Urbana-Champaign, IL, USA, 1992.
Don Roberts, John Brant, and Ralph Johnson. A refactoring tool for Smalltalk. Theory and Practice of Object Systems, 3(4), 1997.
Don Bradley Roberts. Practical Analysis for Refactoring. PhD thesis, University of Illinois, Urbana-Champaign, IL, USA, 1999.
L. Tokuda and D. Batory. Evolving object-oriented architectures with refactorings. In Conf on Automated Software Engineering, Orlando, Florida, 1999.
Mark van den Brand, Paul Klint, and Chris Verhoef. Re-engineering needs generic programming language technology. ACM SIGPLAN Notices, 2(32):54–61, February 1997.
Laszlo Vidacs, Arpad Beszedes, and Rudolf Ferenc. Columbus schema for c/c++ preprocessing. In 8th European Conference on Software Maintenance and Reengineering, Tampere, Finland, pages 75–84. IEEE Computer Society, 2004.
Marian Vittek. A refactoring browser with preprocessor. In Procceedings of the seventh European Conference on Software Maintenance and Reengineering, Benevento, Italy, pages 101–111. IEEE Computer Society Press, 2003.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 International Federation for Information Processing
About this paper
Cite this paper
Vittek, M., Borovansky, P., Moreau, PE. (2006). A C++ Refactoring Browser and Method Extraction. In: Sacha, K. (eds) Software Engineering Techniques: Design for Quality. IFIP International Federation for Information Processing, vol 227. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-39388-9_31
Download citation
DOI: https://doi.org/10.1007/978-0-387-39388-9_31
Publisher Name: Springer, Boston, MA
Print ISBN: 978-0-387-39387-2
Online ISBN: 978-0-387-39388-9
eBook Packages: Computer ScienceComputer Science (R0)