In the context of Microservice Architecture (MSA), Domain-driven Design (DDD) denotes a model-driven approach for domain decomposition and service identification. However, DDD-based domain models are typically expressed as informal UML class diagrams, which hampers model operations like code generation. As a first step to overcome this limitation, we present a UML profile that formalizes DDD-based domain models and enables domain-driven Microservice design.
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Towards a UML Profile for Domain-driven Design of Microservice Architectures
1. Towards a UML Profile for Domain-driven Design of
Microservice Architectures
Microservices 2017
Florian Rademacher
University of Applied Sciences and Arts Dortmund
Institute for Digital Transformation of Application and Living Domains
florian.rademacher@fh-dortmund.de
October 25, 2017 – Odense, Denmark
2. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 1
3. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 2
4. The published Paper
presentation of our paper “Towards a UML Profile for Domain-driven
Design of Microservice Architectures” from this year’s Microservices:
Science and Engineering Workshop (MSE@SEFM 2017)
preprint available online
(see the abstract at http://conf-micro.services for the link)
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 3
5. Domain-driven Design
Domain-driven Design (DDD)
set of model-driven practices, techniques and principles for software
design
primary design drivers: application domain, concepts and concept
relationships
selected core principles
... capturing of domain knowledge in domain models
... collaborative modeling of domain experts and software engineers
(⇒ ubiquitous language)
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 4
6. Domain-driven Design
Structural Domain Models
selective abstractions of conceptual knowledge about a domain or
relevant domain parts
typically modeled as informal UML class diagrams with DDD patterns
like Entity, Value Object, Aggregate, Repository
role
Cargo Aggregate
*
Customer Repository
find by name(String)
find by Customer ID(String)
Cargo Repository
find by Tracking ID(String)
find by Customer ID(String)
Delivery Specification Value Object
arrival time
Handling Event Entity
completion time
type
Customer Entity
name
customer ID
*
*
goal
handled
*
Cargo Entity
tracking ID
Figure 1: Structural domain model with DDD patterns1
1
Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 5
7. Domain-driven Design and Microservice Architecture
DDD and MSA2
1 identification of Bounded Contexts and shared Value Objects in
domain models
2 mapping of Bounded Contexts and shared Value Objects to functional
Microservices and interfaces
role
Cargo Bounded Context
Customer Shared Value Object
customer ID
Customer Bounded Context
Cargo Aggregate
*
Customer Repository
find by name(String)
find by Customer ID(String)
Cargo Repository
find by Tracking ID(String)
find by Customer ID(String)
Delivery Specification Value Object
arrival time
Handling Event Entity
completion time
type
Customer Entity
name
customer ID
«use»
*
*
goal
handled
*
Cargo Entity
tracking ID
Figure 2: Domain model with Bounded Contexts and shared Value Object
2
Newman, Building Microservices, 2015.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 6
8. Domain-driven Design and Microservice Architecture
Limitation: DDD is rather informal
DDD patterns lack formal, UML-based foundation
DDD patterns differ in notation
⇒ prevention of structured model operations like model transformation or
semantic validation
⇒ decrease of models’ possible value
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 7
9. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 8
10. Research Questions
RQ 1
Next to DDD patterns, which basic modeling constructs need to be
supported for Domain-driven Microservice Architecture Modeling
(DDMM)?
RQ 2.1
How can UML’s profile mechanism be utilized to support DDMM?
RQ 2.2
Which basic model transformations need to be supported for DDMM?
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 9
11. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 10
12. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
13. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
14. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
15. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
16. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
17. Survey on UML Elements in DDD
Survey on UML Elements in DDD
survey of 92 UML class diagrams3
representing real-world structural
domain models
results (UML-conform elements only):
# Element Category Occurrence Count
1 Class Classes 92 (100%)
2 Attribute Attributes 72 (78.26%)
3 Multiplicity Multiplicities 67 (72.82%)
4 Non-navigable Association Associations 58 (63.04%)
5 Method Methods 49 (53.26%)
6 Unidirectional Navigable Association Associations 36 (39.13%)
7 Non-navigable Aggregation Associations 28 (30.43%)
8 “extends” Relationship (Inheritance) Associations 23 (25%)
9 Informal Constraint Constraints 13 (14.13%)
10 Unidirectional Navigable Aggregation Associations 11 (11.95%)
11 Formal Constraint Constraints 6 (6.52%)
12 Semi-formal Constraint Constraints 3 (3.26%)
13 Class Dependency Associations 2 (2.17%)
Table 1: Results of surveying UML elements of structural domain models
3
from Evans, Domain-Driven Design, 2004.
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 11
18. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 12
19. A UML Profile for Domain-driven MSA Modeling
A UML Profile for Domain-driven MSA Modeling
stereotypes for DDD patterns as extensions to UML metaclasses
«Stereotype»
Module
«Stereotype»
AggregatePart
aggregateRoot : Class
«Stereotype»
AggregateRoot
«Stereotype»
BoundedContext
«Metaclass»
Package
«Stereotype»
Closure
«Stereotype»
SideEffectFree
«Stereotype»
ValidatesSpec
«Stereotype»
Spec
«Stereotype»
Repository
«Stereotype»
Entity
«Stereotype»
Service
«Stereotype»
DefinesIdentity
«Stereotype»
ValueObject
immutable : Boolean
«Metaclass»
Property
«Metaclass»
Operation
«Metaclass»
Class
Figure 3: The UML profile’s stereotypes for DDD patterns
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 13
20. A UML Profile for Domain-driven MSA Modeling
A UML Profile for Domain-driven MSA Modeling
OCL constraints to ensure intended usage of pattern stereotypes
Stereotype Constraints based on UML Metamodel
AggregatePart
C1: Only Entities and Value Objects may be Aggregate parts
C2: Assigned Aggregate root must have AggregateRoot stereotype
C3: No incoming Associations from outside the Aggregate
C4: Must be in same Bounded Context as Aggregate root
AggregateRoot
C5: Only Entities may be Aggregate roots
C6: Aggregate must contain at least one part
Entity C7: One Operation or at least one Property defines the identity
Repository
C8: Class has no other stereotypes
C9: Class contains only Operations and at least one
C10: Outgoing Associations must point to Entities or Value Objects
DefinesIdentity
C19: Must not be specification validation Operation
C20: May only be applied within Entities
BoundedContext
C24: Must not have Module stereotype
C25: Must not be nested, i.e. part of another Package
Table 2: Selected stereotype constraints
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 14
21. A UML Profile for Domain-driven MSA Modeling
Mapping profile-based models to MSA implementation
determination of Microservice interfaces from Bounded Contexts
on the basis of context associations
associated context-external concepts or shared Value Objects as
signature types
DDD patterns Repository or Service for explicit interface operation
definition
open question 1: How to specify technical characteristics?
open question 2: Which concrete operation of Repository or Service
shall be used?
open question 3: Which concrete shared Value Object shall be used?
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 15
22. Table of Contents
1 Introduction
2 Research Questions
3 Survey on UML Elements in Domain-driven Design
4 A UML Profile for Domain-driven Microservice Architecture Modeling
5 Conclusion and Future Work
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 16
23. Conclusion and Future Work
Conclusion
characterization of DDD by means of a literature survey with 92
structural domain models
initial UML profile for DDMM
Future Work
main focus: implementation of model transformations for eventually
deriving MSA code from profile-based models
transformation of Bounded Contexts into services with deriving
interfaces from context associations
Florian Rademacher Towards a UML Profile for Domain-driven Design of MSAs 17