Skip to main content

Techniques for Lightweight Generator Refactoring

  • Chapter

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4143))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Apache Velocity Website, http://jakarta.apache.org/velocity/

  2. Poseidon for UML Website, http://www.gentleware.com

  3. 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)

    Article  Google Scholar 

  4. 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)

    Chapter  Google Scholar 

  5. Donnelly, C., Stallman, R.: Bison: The Yacc-Compatible Parser Generator. iUniverse Inc. (2000)

    Google Scholar 

  6. Eclipse Website, http://eclipse.org

  7. Fowler, M.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Reading (1999)

    Google Scholar 

  8. Fowler, M.: Generating Code for DSLs (2005), http://www.martinfowler.com/articles/codeGenDsl.html

  9. Gagnon, E., Hendren, L.: SableCC – an object-oriented compiler framework. In: TOOLS 1998 (August 1998)

    Google Scholar 

  10. Herrington, J.: Code Generation in Action. Manning Publications Co. (2003)

    Google Scholar 

  11. Opdyke, W.F.: Refactoring Object-Oriented Frameworks. PhD thesis, University of Illinois at Urbana-Champaign (1992)

    Google Scholar 

  12. Parr, T.J., Quong, R.W.: ANTLR: A predicated-LL(k) parser generator. Software – Practice and Experience 25(7), 789–810 (1995)

    Article  Google Scholar 

  13. Rumpe, B.: Agile Modellierung mit UML: Codegenerierung, Testfälle, Refactoring. Xpert.press. Springer, Heidelberg (2005)

    MATH  Google Scholar 

  14. Visser, J.: Visitor combination and traversal control. In: Proc. of OOPSLA 2001, pp. 270–282. ACM Press, New York (2001)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics