Skip to main content

Reuse and Customization for Code Generators: Synergy by Transformations and Templates

  • Conference paper
  • First Online:
Book cover Model-Driven Engineering and Software Development (MODELSWARD 2018)

Abstract

Engineering languages for model-driven development (MDD) highly rely on code generators that systematically and efficiently generate source code from abstract models. Although code generation is an essential technique, there is still a lot of ad hoc mechanisms in use that prevent an efficient and reliable use and especially reuse of code generators.

The first part of the paper focuses on general mechanisms necessary to really allow reuse of flexible code generators. Based on these general considerations, we present a code generator infrastructure, that allows to easily develop a generator, but especially allows to adapt existing generators to different technology stacks and thus widely supports reusability, customizability, and flexibility.

In the second part of the paper, we present an integrated template- and transformation-based code generation approach. It enables efficient code generation of object-oriented code and retains the benefits of both approaches. Even more, its synergetic use improves usability beyond using just a single approach. Internally, an intermediate representation (IR) and a separation of the code generation process into three main steps is used. First, the input model is processed and transformed to the IR. Second, elements in the IR are manipulated by source and target language independent transformations. Target language specific implementations are added by templates, which are attached to IR elements. Third, the resulting IR is used by a template engine to generate code with a predefined set of default templates for a particular target language. The overall goal of this paper is to show how to address necessary code generator considerations to effectively and efficiently use engineering languages in MDD.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

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 EPUB and 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

Institutional subscriptions

References

  1. Baar, T., Whittle, J.: On the usage of concrete syntax in model transformation rules. In: Virbitskaite, I., Voronkov, A. (eds.) PSI 2006. LNCS, vol. 4378, pp. 84–97. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-70881-0_10

    Chapter  Google Scholar 

  2. Balogh, A., Varró, D.: Advanced model transformation language constructs in the VIATRA2 framework. In: ACM Symposium on Applied Computing. ACM (2006)

    Google Scholar 

  3. Brunelière, H., Cabot, J., Dupé, G., Madiot, F.: MoDisco: a model driven reverse engineering framework. Inf. Softw. Technol. 56(8), 1012–1032 (2014)

    Article  Google Scholar 

  4. Chared, Z., Tyszberowicz, S.S.: Projective template-based code generation. In: CAiSE 2013 Forum at the 25th International Conference on Advanced Information Systems Engineering, vol. 998. CEURS-WS.org (2013)

    Google Scholar 

  5. ekkes corner: Mobile & & IoT, October 2015. https://ekkescorner.wordpress.com/2009/07/16/galileo-openarchitectureware-moved-to-eclipse-modeling-projects-oaw5/

  6. Czarnecki, K., Eisenecker, U.W.: Generative Programming: Methods, Tools, and Applications. Addison-Wesley, Boston (2000)

    Google Scholar 

  7. Czarnecki, K., Helsen, S.: Classification of model transformation approaches. In: 2nd OOPSLA 2003 Workshop on Generative Techniques in the Context of MDA (2003)

    Google Scholar 

  8. Czarnecki, K., Helsen, S.: Feature-based survey of model transformation approaches. IBM Syst. J. 45(3), 621–645 (2006)

    Article  Google Scholar 

  9. Di Ruscio, D., Eramo, R., Pierantonio, A.: Model transformations. In: Bernardo, M., Cortellessa, V., Pierantonio, A. (eds.) SFM 2012. LNCS, vol. 7320, pp. 91–136. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-30982-3_4

    Chapter  Google Scholar 

  10. El Beggar, O., Bousetta, B., Gadi, T.: Automatic code generation by model transformation from sequence diagram of system’s internal behavior. Int. J. Comput. Inf. Technol. 1(02), 129–146 (2012)

    Google Scholar 

  11. Eliens, A.: Principles of Object-Oriented Software Development. Addison-Wesley Longman Publishing Co. Inc., Boston (1994)

    MATH  Google Scholar 

  12. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Professional, Boston (1995)

    MATH  Google Scholar 

  13. Geiger, L., Schneider, C., Reckord, C.: Template- and modelbased code generation for MDA-tools. Technical report (2005)

    Google Scholar 

  14. Génova, G., Del Castillo, C.R., Llorens, J.: Mapping UML associations into Java code. J. Object Technol. 2(5), 135–162 (2003)

    Article  Google Scholar 

  15. Gessenharter, D.: Implementing UML associations in Java: a slim code pattern for a complex modeling concept. In: Workshop on Relationships and Associations in Object-Oriented Languages (RAOOL 2009). ACM (2009)

    Google Scholar 

  16. Girschick, M.: Integrating template-based code generation into graphical model transformation. In: Modellierung 2008, Berlin (2008)

    Google Scholar 

  17. Greifenberg, T., et al.: A comparison of mechanisms for integrating handwritten and generated code for object-oriented programming languages. CoRR abs/1509.04498 (2015)

    Google Scholar 

  18. Greifenberg, T., et al.: Integration of Handwritten and Generated Object-Oriented Code. In: Desfray, P., Filipe, J., Hammoudi, S., Pires, L.F. (eds.) MODELSWARD 2015. CCIS, vol. 580, pp. 112–132. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-27869-8_7

    Chapter  Google Scholar 

  19. Haase, A., Völter, M., Efftinge, S., Kolb, B.: Introduction to openArchitectureWare 4.1. 2. In: MDD Tool Implementers Forum at TOOLS Europe (2007). http://www.dsmforum.org/events/mdd-tif07/oAW.pdf

  20. Hemel, Z., Kats, L.C.L., Groenewegen, D.M., Visser, E.: Code generation by model transformation: a case study in transformation modularity. Softw. Syst. Model. 9(3), 375–402 (2010)

    Article  Google Scholar 

  21. Krahn, H., Rumpe, B., Völkel, S.: MontiCore: modular development of textual domain specific languages. In: Paige, R.F., Meyer, B. (eds.) TOOLS EUROPE 2008. LNBIP, vol. 11, pp. 297–315. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-69824-1_17

    Chapter  Google Scholar 

  22. Krahn, H., Rumpe, B., Völkel, S.: MontiCore: a framework for compositional development of domain specific languages. Int. J. Softw. Tools Technol. Transfer (STTT) 12, 353–372 (2010)

    Article  Google Scholar 

  23. Kundu, D., Samanta, D., Mall, R.: Automatic code generation from unified modelling language sequence diagrams. IET Softw. 7(1), 12–28 (2013)

    Article  Google Scholar 

  24. Mens, T., Czarnecki, K., Gorp, P.V.: A taxonomy of model transformations. In: Language Engineering for Model-Driven Software Development. Dagstuhl Seminar Proceedings. Internationales Begegnungs- und Forschungszentrum (IBFI) (2005)

    Google Scholar 

  25. Mir Seyed Nazari, P., Roth, A., Rumpe, B.: Mixed generative and handcoded development of adaptable data-centric business applications. In: Proceedings of the Workshop on Domain-Specific Modeling. ACM (2015)

    Google Scholar 

  26. Mohan, R., Kulkarni, V.: Model driven development of graphical user interfaces for enterprise business applications – experience, lessons learnt and a way forward. In: Schürr, A., Selic, B. (eds.) MODELS 2009. LNCS, vol. 5795, pp. 307–321. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-04425-0_23

    Chapter  Google Scholar 

  27. Reiß, D.: Modellgetriebene generative Entwicklung von Web-Informationssystemen. Ph.D. thesis, RWTH Aachen University, Aachen (2015)

    Google Scholar 

  28. Roth, A., Rumpe, B.: Towards product lining model-driven development code generators. In: 3rd International Conference on Model-Driven Engineering and Software Development. Springer, Cham (2015)

    Google Scholar 

  29. Rumpe, B.: Modeling with UML. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-33933-7

    Book  MATH  Google Scholar 

  30. Rumpe, B., Weisemöller, I.: A domain specific transformation language. In: Workshop on Models and Evolution, vol. 11 (2011)

    Google Scholar 

  31. Rumpe, B.: Agile Modeling with UML: Code Generation, Testing, Refactoring. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-58862-9

    Book  MATH  Google Scholar 

  32. Störzer, M., Koppen, C.: PCDiff: attacking the fragile pointcut problem. In: European Interactive Workshop on Aspects in Software (2004)

    Google Scholar 

  33. Swint, G.S., et al.: Clearwater: extensible, flexible, modular code generation. In: 20th IEEE/ACM International Conference on Automated software engineering. ACM (2005)

    Google Scholar 

  34. Visser, E.: Meta-programming with concrete object syntax. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 299–315. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45821-2_19

    Chapter  Google Scholar 

  35. Voelter, M., et al.: DSL Engineering - Designing, Implementing and Using Domain-Specific Languages (2013). dslbook.org

  36. Wachsmuth, G.: A formal way from text to code templates. In: Chechik, M., Wirsing, M. (eds.) FASE 2009. LNCS, vol. 5503, pp. 109–123. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00593-0_8

    Chapter  Google Scholar 

  37. www: OMG UML Specification, October 2015. http://www.omg.org/spec/HrBUML/2.5/HrB

  38. www: openarchitectureware, October 2015. https://web.archive.org/web/20140225123932/http://www.openarchitectureware.org/index.php

  39. www: Apache maven project, August 2017. https://maven.apache.org/

  40. Zschaler, S., Rashid, A.: Symmetric language-aware aspects for modular code generators. Technical Report TR-11-01, King’s College, Department of Informatics (2011)

    Google Scholar 

  41. Zschaler, S., Rashid, A.: Towards modular code generators using symmetric language-aware aspects. In: Proceedings of the 1st International Workshop on Free Composition. FREECO 2011, pp. 6:1–6:5. ACM, New York (2011)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Robert Eikermann .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Eikermann, R., Hölldobler, K., Roth, A., Rumpe, B. (2019). Reuse and Customization for Code Generators: Synergy by Transformations and Templates. In: Hammoudi, S., Pires, L., Selic, B. (eds) Model-Driven Engineering and Software Development. MODELSWARD 2018. Communications in Computer and Information Science, vol 991. Springer, Cham. https://doi.org/10.1007/978-3-030-11030-7_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-11030-7_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-11029-1

  • Online ISBN: 978-3-030-11030-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics