Document Open Access Logo

Correct-By-Construction Microservices with Model-Driven Engineering: The Case for Architectural Pattern Conformance Checking and Pattern-Conform Code Generation

Author Florian Rademacher

Thumbnail PDF


  • Filesize: 0.93 MB
  • 25 pages

Document Identifiers

Author Details

Florian Rademacher
  • Software Engineering, RWTH Aachen University, Germany

Cite AsGet BibTex

Florian Rademacher. Correct-By-Construction Microservices with Model-Driven Engineering: The Case for Architectural Pattern Conformance Checking and Pattern-Conform Code Generation. In Joint Post-proceedings of the Third and Fourth International Conference on Microservices (Microservices 2020/2022). Open Access Series in Informatics (OASIcs), Volume 111, pp. 8:1-8:25, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


Patterns are a common metaphor in software engineering that denotes reusable solutions for recurring software engineering problems. Architectural patterns focus on the interplay or organization of two or more components of a software system, and are particularly helpful in the design of complex software architectures such as those produced by Microservice Architecture (MSA). This paper presents an approach for the language-based reification of architectural MSA patterns. To this end, we introduce a method to flexibly retrofit LEMMA (Language Ecosystem for Modeling Microservices) with support for modeling and implementing architectural MSA patterns. The method relies on the (i) specification of aspects to reify pattern applications in MSA models; (ii) validation of pattern applications; and (iii) code generation from correct pattern applications. Consequently, it contributes to correct-by-construction microservices by abstracting from the complexity of pattern implementations, yet still enabling their automated production with Model-Driven Engineering. We validate our method with the popular Domain Event and Command Query Responsibility Segregation patterns, and assess its applicability for 28 additional patterns. Our results show that LEMMA’s expressivity covers the model-based expression of complex architectural MSA patterns and that its model processing facilities support pattern-specific extensions such that conformance checking and pattern-conform code generation can be modularized into reusable model processors.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Domain specific languages
  • Software and its engineering → Software design engineering
  • Software and its engineering → Source code generation
  • Software and its engineering → Model-driven software engineering
  • Software and its engineering → Software architectures
  • Software and its engineering → Cloud computing
  • Microservice Architecture
  • Architectural Patterns
  • Model-Driven Engineering
  • Static Model Analysis
  • Model Validation
  • Code Generation
  • Architectural Pattern Conformance Checking


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Christopher Alexander, Sara Ishikawa, Murray Silverstein, Max Jacobson, Ingrid Fiksdahl-King, and Shlomo Angel. A Pattern Language. Oxford University Press, 1977. Google Scholar
  2. Nuha Alshuqayran, Nour Ali, and Roger Evans. Towards micro service architecture recovery: An empirical study. In 2018 Int. Conf. on Softw. Architecture (ICSA), pages 47-56. IEEE, 2018. URL:
  3. David Ameller, Xavier Burgués, Oriol Collell, Dolors Costal, Xavier Franch, and Mike P. Papazoglou. Development of service-oriented architectures using model-driven development: A mapping study. Information and Software Technology, 62:42-66, 2015. Elsevier. URL:
  4. Paul Baker, Shiou Loh, and Frank Weil. Model-Driven Engineering in a large industrial context - Motorola case study. In Model Driven Engineering Languages and Systems, pages 476-491, Berlin, Heidelberg, 2005. Springer. URL:
  5. Len Bass, Paul Clements, and Rick Kazman. Software Architecture in Practice. Addison-Wesley, third edition, 2013. Google Scholar
  6. Len Bass, Ingo Weber, and Liming Zhu. DevOps: A Software Architect’s Perspective. Pearson, 2015. URL:
  7. Justus Bogner, Jonas Fritzsch, Stefan Wagner, and Alfred Zimmermann. Microservices in industry: Insights into technologies, characteristics, and software quality. In 2019 Int. Conf. on Softw. Architecture Companion (ICSA-C), pages 187-195. IEEE, 2019. URL:
  8. Frank Buschmann, Kelvin Henney, and Douglas Schimdt. Pattern-Oriented Software Architecture, volume 5. Wiley, 2007. URL:
  9. Abdullah Chihada, Saeed Jalili, Seyed Mohammad Hossein Hasheminejad, and Mohammad Hossein Zangooei. Source code and design conformance, design pattern detection from source code by classification approach. Applied Soft Computing, 26:357-367, 2015. URL:
  10. Benoit Combemale, Robert B. France, Jean-Marc Jézéquel, Bernhard Rumpe, Jim Steel, and Didier Vojtisek. Engineering Modeling Languages: Turning Domain Knowledge into Tools. CRC, 2017. Google Scholar
  11. Microsoft Corporation. Language Server Protocol specification - 3.17, 2022. URL:
  12. Nicola Dragoni, Ivan Lanese, Stephan Thordal Larsen, Manuel Mazzara, Ruslan Mustafin, and Larisa Safina. Microservices: How to make your application scale. In Perspectives of System Informatics, pages 95-104. Springer, 2018. URL:
  13. Duc Minh Le, Duc-Hanh Dang, and Viet-Ha Nguyen. Domain-driven design using meta-attributes: A DSL-based approach. In 2016 Eighth International Conference on Knowledge and Systems Engineering (KSE), pages 67-72. IEEE, 2016. URL:
  14. J.A. Díaz-Pace, Álvaro Soria, Guillermo Rodríguez, and Marcelo R. Campo. Assisting conformance checks between architectural scenarios and implementation. Information and Software Technology, 54(5):448-466, 2012. URL:
  15. Eric Evans. Domain-Driven Design. Addison-Wesley, 2004. Google Scholar
  16. Eric Evans. Domain-Driven Design Reference. Dog Ear Publishing, 2015. Google Scholar
  17. Michael Falkenthal, Johanna Barzen, Uwe Breitenbücher, Christoph Fehling, and Frank Leymann. From pattern languages to solution implementations. In Proceedings of the 6th International Conference on Pervasive Patterns and Applications (PATTERNS 2014), pages 12-21. Xpert Publishing Services (XPS), 2014. Google Scholar
  18. Nicolas Ferry, Alessandro Rossini, Franck Chauvel, Brice Morin, and Arnor Solberg. Towards model-driven provisioning, deployment, monitoring, and adaptation of multi-cloud systems. In 2013 IEEE Sixth International Conference on Cloud Computing, pages 887-894. IEEE, 2013. URL:
  19. Robert France and Bernhard Rumpe. Model-driven development of complex software: A research roadmap. In 2007 Future of Software Engineering (FOSE), pages 37-54. IEEE, 2007. URL:
  20. Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995. Google Scholar
  21. Saverio Giallorenzo, Fabrizio Montesi, Marco Peressotti, and Florian Rademacher. Model-driven generation of microservice interfaces: From LEMMA domain models to Jolie APIs. In Coordination Models and Languages, pages 223-240. Springer, 2022. URL:
  22. James Gosling, Bill Joy, Guy Steele, Gilad Bracha, Alex Buckley, Daniel Smith, and Gavin Bierman. The Java language specification: Java SE 17 edition. JSR-392, Oracle Inc., 2021. Google Scholar
  23. Giona Granchelli, Mario Cardarelli, Paolo Di Francesco, Ivano Malavolta, Ludovico Iovino, and Amleto Di Salle. Towards recovering the software architecture of microservice-based systems. In 2017 Int. Conf. on Softw. Arch. Workshops (ICSAW), pages 46-53. IEEE, 2017. URL:
  24. ISO/IEC/IEEE. Systems and software engineering - Architecture description, 2011. Google Scholar
  25. JHipster. Jhipster domain language (jdl), 2022-14-02. URL:
  26. Ralph E. Johnson and Brian Foote. Designing reusable classes. Journal of Object-Oriented Programming, 1(2):22-35, 1988. SIGS Publications. Google Scholar
  27. Robbert Jongeling, Jan Carlson, and Antonio Cicchetti. Impediments to introducing continuous integration for model-based development in industry. In 45th Euromicro Conference on Software Engineering and Advanced Applications (SEAA), pages 434-441. IEEE, 2019. URL:
  28. Stefan Kapferer and Olaf Zimmermann. Domain-driven service design. In Service-Oriented Computing, pages 189-208. Springer, 2020. URL:
  29. Stefan Kapferer and Olaf Zimmermann. Domain-specific language and tools for strategic Domain-driven Design, context mapping and bounded context modeling. In Proceedings of the 8th International Conference on Model-Driven Engineering and Software Development - Volume 1: MODELSWARD, pages 299-306. INSTICC, SciTePress, 2020. URL:
  30. Dae-Kyoo Kim and Wuwei Shen. Evaluating pattern conformance of uml models: a divide-and-conquer approach and case studies. Software Quality Journal, 16(3):329-359, sep 2008. URL:
  31. Jörg Christian Kirchhof, Bernhard Rumpe, David Schmalzing, and Andreas Wortmann. Montithings: Model-driven development and deployment of reliable iot applications. Journal of Systems and Software, 183:111087, 2022. URL:
  32. Kevin Lano and Shekoufeh Kolahdouz-Rahimi. Model-transformation design patterns. IEEE Transactions on Software Engineering, 40(12):1224-1259, 2014. IEEE. URL:
  33. Parastoo Mohagheghi and Vegard Dehlen. Where is the proof? - A review of experiences from applying MDE in industry. In Model Driven Architecture - Foundations and Applications, pages 432-443. Springer, 2008. URL:
  34. Mustafa Abshir Mohamed, Moharram Challenger, and Geylani Kardas. Applications of model-driven engineering in cyber-physical systems: A systematic mapping study. Journal of Computer Languages, 59:1-54, 2020. URL:
  35. Gastón Márquez and Hernán Astudillo. Actual use of architectural patterns in microservices-based open source projects. In 25th Asia-Pacific Software Engineering Conference (APSEC), pages 31-40. IEEE, 2018. URL:
  36. Sam Newman. Building Microservices: Designing Fine-Grained Systems. O'Reilly, 2015. URL:
  37. Evangelos Ntentos, Uwe Zdun, Konstantinos Plakidas, and Sebastian Geiger. Evaluating and improving microservice architecture conformance to architectural design decisions. In Hakim Hacid, Odej Kao, Massimo Mecella, Naouel Moha, and Hye-young Paik, editors, Service-Oriented Computing, pages 188-203, Cham, 2021. Springer International Publishing. URL:
  38. Evangelos Ntentos, Uwe Zdun, Konstantinos Plakidas, Sebastian Meixner, and Sebastian Geiger. Metrics for assessing architecture conformance to microservice architecture patterns and practices. In Eleanna Kafeza, Boualem Benatallah, Fabio Martinelli, Hakim Hacid, Athman Bouguettaya, and Hamid Motahari, editors, Service-Oriented Computing, pages 580-596, Cham, 2020. Springer International Publishing. URL:
  39. OMG. OMG Unified Modeling Language (OMG UML) version 2.5.1. Standard formal/17-12-05, Object Management Group, 2017. Google Scholar
  40. Florian Rademacher. Kafka plugin for LEMMA’s Java Base Generator on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/code%252520generators/de.fhdo.lemma.model_processing.code_generation.springcloud.kafka/.
  41. Florian Rademacher. Service model validator in the kafka plugin for LEMMA’s Java Base Generator on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/code%20generators/de.fhdo.lemma.model_processing.code_generation.springcloud.kafka/src/main/kotlin/de/fhdo/lemma/model_processing/code_generation/springcloud/kafka/validators/ServiceModelSourceValidator.kt.
  42. Florian Rademacher. CQRS model validator on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/code%20generators/de.fhdo.lemma.model_processing.code_generation.springcloud.cqrs/src/main/kotlin/de/fhdo/lemma/model_processing/code_generation/springcloud/cqrs/validators/ServiceModelSourceValidator.kt.
  43. Florian Rademacher. Domain Event code generation handler on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/code%20generators/de.fhdo.lemma.model_processing.code_generation.springcloud.domain_events/src/main/kotlin/de/fhdo/lemma/model_processing/code_generation/springcloud/domain_events/handlers/DataStructureHandler.kt.
  44. Florian Rademacher. Domain Event model validator on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/code%20generators/de.fhdo.lemma.model_processing.code_generation.springcloud.domain_events/src/main/kotlin/de/fhdo/lemma/model_processing/code_generation/springcloud/domain_events/validators/ServiceModelSourceValidator.kt.
  45. Florian Rademacher. AbstractXtextModelValidator class of lemma’s model processing framework on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/de.fhdo.lemma.model_processing/src/main/kotlin/de/fhdo/lemma/model_processing/phases/validation/AbstractXtextModelValidator.kt.
  46. Florian Rademacher. lemma domain model on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/examples/charging-station-management/models/domain/
  47. Florian Rademacher. SourceModelValidator annotation of lemma’s model processing framework on Software Heritage. URL:;origin=;visit=swh:1:snp:a668854675d50d3f3cad56eb5e3961b683d0f70a;anchor=swh:1:rev:2e9ccc882352116b253a7700b5ecf2c9316a5829;path=/de.fhdo.lemma.model_processing/src/main/kotlin/de/fhdo/lemma/model_processing/annotations/SourceModelValidator.kt.
  48. Florian Rademacher. A non-intrusive approach to extend microservice modeling languages with architecture pattern support. In Third Int. Conf. on Microservices (Microservices 2020), 2020. URL:
  49. Florian Rademacher. A Language Ecosystem for Modeling Microservice Architecture. PhD thesis, University of Kassel, 2022. URL:
  50. Florian Rademacher, Martin Peters, and Sabine Sachweh. Design of a domain-specific language based on a technology-independent web service framework. In Software Architecture, pages 357-371. Springer, 2015. URL:
  51. Florian Rademacher, Sabine Sachweh, and Albert Zündorf. Aspect-oriented modeling of technology heterogeneity in Microservice Architecture. In 2019 Int. Conf. on Softw. Architecture (ICSA), pages 21-30. IEEE, 2019. URL:
  52. Florian Rademacher, Sabine Sachweh, and Albert Zündorf. A modeling method for systematic architecture reconstruction of microservice-based software systems. In Enterprise, Business-Process and Information Systems Modeling, pages 311-326. Springer, 2020. URL:
  53. Florian Rademacher, Jonas Sorgalla, Philip Wizenty, and Simon Trebbau. Towards holistic modeling of microservice architectures using LEMMA. In Companion Proc. of the 15th European Conf. on Software Architecture 2021, pages 1-10. CEUR-WS, 2021. URL:
  54. Florian Rademacher, Jonas Sorgalla, Philip Wizenty, and Simon Trebbau. Towards an extensible approach for generative microservice development and deployment using lemma. In Patrizia Scandurra, Matthias Galster, Raffaela Mirandola, and Danny Weyns, editors, Software Architecture, pages 257-280. Springer, 2022. URL:
  55. Chris Richardson. Microservices Patterns. Manning Publications, 2019. Google Scholar
  56. Davide Di Ruscio, Ivano Malavolta, Henry Muccini, Patrizio Pelliccione, and Alfonso Pierantonio. Developing next generation ADLs through MDE techniques. In 32nd Int. Conf. on Software Engineering (ICSE), volume 1, pages 85-94. IEEE, 2010. URL:
  57. Gerald Schermann, Jürgen Cito, and Philipp Leitner. All the services large and micro: Revisiting industrial practice in services computing. In Service-Oriented Computing - ICSOC 2015 Workshops, pages 36-47. Springer, 2016. URL:
  58. Stefan Sobernig and Uwe Zdun. Inversion-of-Control layer. In Proc. of the 15th European Conf. on Pattern Languages of Programs, pages 1-22. ACM, 2010. URL:
  59. Jacopo Soldani, Damian Andrew Tamburri, and Willem-Jan Van Den Heuvel. The pains and gains of microservices: A systematic grey literature review. Journal of Systems and Software, 146:215-232, 2018. Elsevier. URL:
  60. Stephen Soltesz, Herbert Pötzl, Marc E. Fiuczynski, Andy Bavier, and Larry Peterson. Container-based operating system virtualization: A scalable, high-performance alternative to hypervisors. In Proc. of the 2nd Europ. Conf. on Computer Systems 2007, pages 275-287. ACM, 2007. URL:
  61. Jonas Sorgalla, Philip Wizenty, Florian Rademacher, Sabine Sachweh, and Albert Zündorf. AjiL: Enabling model-driven microservice development. In Proc. of the 12th Europ. Conf. on Softw. Architecture: Companion Proceedings, pages 1:1-1:4. ACM, 2018. URL:
  62. Tiago Boldt Sousa, Hugo Sereno Ferreira, and Filipe Figueiredo Correia. A survey on the adoption of patterns for engineering software for the cloud. IEEE Transactions on Software Engineering, 48(6):2128-2140, 2022. URL:
  63. Branko Terzić, Vladimir Dimitrieski, Slavica Kordić, Gordana Milosavljević, and Ivan Luković. Development and evaluation of MicroBuilder: a model-driven tool for the specification of REST microservice software architectures. Enterprise Information Systems, 12:1034-1057, 2018. URL:
  64. Guilherme Vale, Filipe Figueiredo Correia, Eduardo Martins Guerra, Thatiane de Oliveira Rosa, Jonas Fritzsch, and Justus Bogner. Designing microservice systems using patterns: An empirical study on quality trade-offs. In 19th Int. Conf. on Softw. Architecture (ICSA), pages 69-79, 2022. URL:
  65. Matias Ezequiel Vara Larsen, Julien DeAntoni, Benoit Combemale, and Frédéric Mallet. A behavioral coordination operator language (bcool). In 18th Int. Conf. on Model Driven Engineering Languages and Systems (MODELS), pages 186-195, 2015. URL:
  66. Jon Whittle, John Hutchinson, and Mark Rouncefield. The state of practice in Model-Driven Engineering. IEEE Software, 31(3):79-85, 2014. IEEE. URL:
  67. Andreas Wortmann, Olivier Barais, Benoit Combemale, and Manuel Wimmer. Modeling languages in industry 4.0: an extended systematic mapping study. Software and Systems Modeling, 19(1):67-94, jan 2020. URL:
  68. Cheng Zhang and David Budgen. What do we know about the effectiveness of software design patterns? IEEE Transactions on Software Engineering, 38(5):1213-1231, 2012. URL:
  69. Cheng Zhang and David Budgen. A survey of experienced user perceptions about software design patterns. Information and Software Technology, 55(5):822-835, 2013. URL:
  70. Olaf Zimmermann, Mirko Stocker, Daniel Lübke, Uwe Zdun, and Cesare Pautasso. Patterns for API Design: Simplifying Integration with Loosely Coupled Message Exchanges. Addison-Wesley, 2022. Google Scholar