Abstract
This paper presents an exercise to facilitate refactoring techniques not only on generated code, but also on generator templates by reusing existing refactoring techniques from the target language. Refactoring is particularly useful if not only the generated classes but also the template defining the result of the code generator can be adapted in a uniform treatment. We describe a simple demonstration prototype that illustrates our approach. The demonstration is based on the idea to define the templates for code generation themselves as compilable and therefore refactorable source code. However, this limits the directives embedded in the template used for code generation, as we have to embed those as comments. We explore how far this approach carries and where its limits are.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Apache Velocity Website, http://jakarta.apache.org/velocity/
Poseidon for UML Website, http://www.gentleware.com
van den Brand, M., Moreau, P.-E., Vinju, J.: Generator of efficient strongly typed abstract syntax trees in Java. IEE Proceedings - Software 152(2), 70–78 (2005)
Czarnecki, K., Antkiewicz, M.: Mapping Features to Models: A Template Approach Based on Superimposed Variants. In: Glück, R., Lowry, M. (eds.) GPCE 2005. LNCS, vol. 3676, pp. 422–437. Springer, Heidelberg (2005)
Donnelly, C., Stallman, R.: Bison: The Yacc-Compatible Parser Generator. iUniverse Inc. (2000)
Eclipse Website, http://eclipse.org
Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Reading (1999)
Fowler, M.: Generating Code for DSLs (2005), http://www.martinfowler.com/articles/codeGenDsl.html
Gagnon, E., Hendren, L.: SableCC – an object-oriented compiler framework. In: TOOLS 1998 (August 1998)
Herrington, J.: Code Generation in Action. Manning Publications Co. (2003)
Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)
Parr, T.J., Quong, R.W.: ANTLR: A predicated-LL(k) parser generator. Software – Practice and Experience 25(7), 789–810 (1995)
Rumpe, B.: Agile Modellierung mit UML: Codegenerierung, Testfälle, Refactoring. Xpert.press. Springer, Heidelberg (2005)
Visser, J.: Visitor combination and traversal control. In: Proc. of OOPSLA 2001, pp. 270–282. ACM Press, New York (2001)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Krahn, H., Rumpe, B. (2006). Techniques for Lightweight Generator Refactoring. In: Lämmel, R., Saraiva, J., Visser, J. (eds) Generative and Transformational Techniques in Software Engineering. GTTSE 2005. Lecture Notes in Computer Science, vol 4143. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11877028_19
Download citation
DOI: https://doi.org/10.1007/11877028_19
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-45778-7
Online ISBN: 978-3-540-46235-4
eBook Packages: Computer ScienceComputer Science (R0)