際際滷

際際滷Share a Scribd company logo
Andre Borgonovo
Refreshing Domain Driven Design
An approach to the development of complex software
In which we:
1. Focus on the core domain
2. Explore models in a creative collaboration of domain practitioners and software
practitioners
3. Speak a ubiquitous language within an explicitly bounded context
OK, BUT WHY?
IS IT FOR ME?
DOMAIN
A sphere of knowledge,
influence, or activity. The
subject area to which the user
applies a program is the
domain of the software.
Refreshing Domain Driven Design
Essentially, all models are wrong, but
some are useful.1
 System of abstractions
 Describe selected aspects of the domain
 Solve problems
1: George E. P. Box, British
A language structured around
the domain model and used by
all team members within a
bounded context to connect all
the activities of the team with
the software.
https://martinfowler.com/bliki/BoundedContext.html
MODEL-
DRIVEN
DESIGN
Isolating the domain
Responsible for showing information to the user and
interpreting the users commands.
External actor can be
- A human user or;
- Another computer system.
 Application Services (and/or Command Handlers)
 Adapters
 Workflows
The heart of the business software
 Entities
 Aggregates
 Value Objects
 Repository interfaces
 Factories
 Domain Events
 Domain Services
 Data Persistence (Repositories implementation)
 Gateways to external dependencies
 Infrastructure Services
 Crosscutting concerns:
 Logging
 Exception Handling
 Security
 Caching
 ...
User Interface
Application
Domain
Infrastructure
Infrastructure
Persistencedepends on
compose
MODEL
ELEMENTS
Expressing the Model in Software
An object primarily defined by its
identity
 Artificial x Natural identity
 Anemic Domain
(aka Reference Objects)
https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model
 No identity
 Immutable
Refreshing Domain Driven Design
Refreshing Domain Driven Design
 Root Entity (also called Aggregate Root)
 State changes are made via the root Entity, which ensure the Business rules and
keeps the Aggregate valid
 All children have a reference to the root Entity
 Deletion of the aggregate/root, deletes all children;
https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model
https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/microservice-domain-model
3 types of services
 Application Services
 Domain Services
 Infrastructure Services
Characteristics of a good Domain Service
 Operation relates to a domain concept that is not a natural part of na Entity or
Value Object
 The interface is defined in terms of other elements of the domain model
 The operation is stateless
FACTORIES
When creation of an entire, internally consistente
aggregate, or a large value object, becomes
complicated or reveals too much of the internal
structure, factories provide encapsulation.
Query access to aggregates expressed
in the ubiquitous language.
 Act in a similar way to a set of
domain objects in memory
 Persistence Ignorance Principle
 One repository per aggregate
 No business rules
Refreshing Domain Driven Design
 A representation of something that happened in the domain
 Immutable
 Domain Event != System Event
@DDD_Borat
COMMON
PITFALLS
 Relational database mindset masked as
DDD
 Treating DDD as a recipe
 Starting with technical details
 Being superficial about the Domain
 The "One model to rule them all"
approach
DDD IS MORE
THAN THAT!
Intention-
Revealing
Interfaces
Side-Effect-
Free
Functions
Assertions
Standalone
Classes
Closure of
Operations
Declarative
Design
Drawing on
Established
Formalisms
Conceptual
Contours
Context Map Partnership
Shared
Kernel
Customer/
Supplier
Development
Conformist
Anticorruptio
n Layer
Open-host
Service
Published
Language
Separate
Ways
Big Ball of
Mud
DISTILLATI
ON FOR
STRATEGIC
DESIGN
Core Domain
Generic Subdomains
Domain Vision Statement
Highlighted Core
Cohesive Mechanisms
Segregated Core
Abstract Core
EVOLVING
ORDER
SYSTEM
METAPHOR
RESPONSABILIT
Y LAYERS
KNOWLEDGE
LEVEL
PLUGGABLE
COMPONENT
FRAMEWORK
Refreshing Domain Driven Design
https://devblogs.microsoft.com/cesardelatorre/domain-driven-design-ddd-visual-studio-11-beta-alm-great-fit/
Refreshing Domain Driven Design
MORE
 http://domainlanguage.com/
 https://docs.microsoft.com/en-
us/dotnet/standard/microservices-
architecture/microservice-ddd-cqrs-patterns/
 https://github.com/VaughnVernon/IDDD_Samples
 https://aspnetboilerplate.com/
 https://github.com/vlingo
ANDRE BORGONOVO
Software Consultant at WAES
Design Engineer at ASML
MCSD, PSM, ITIL
linkedin.com/in/azborgonovo
@azborgonovo
Software Developer | Leader | Architect

More Related Content

Refreshing Domain Driven Design

Editor's Notes

  • #5: Increases the project architecture quality Decreases complexity Improves the manutenability You make software to run for years Who should care about Domain-driven design? DDD is forever (technology independente, not only OOP) Comes along with other DDs
  • #6: The focus is on the domain NOT on the database Business software with complex rules
  • #8: Should be kept up to date Use POCO (Plain Old CLR Objects)
  • #9: Ubiquitous = it is everywhere The language used by the Business expert = Domain expert = Product Owner Do not use tech language to talk with the Domain expert Proximity with the Domain expert Analysis should be natural to the Domain expert Nouns => Classes Verbs => Methods, services
  • #10: Continuous Integration => Once a bounded context has been defined, we must keep it sound
  • #12: Layers vs Tiers, Tier is a physical unit where the code/process runs Separation of Responsabilities Flexible architecture
  • #14: Thin layer, no domain logic, no state (only state for long running processes) Commands DTOs Command Handlers Domain Event Handlers
  • #17: Hexagonal Architecture If I have this architecture, do I have DDD? https://blog.ploeh.dk/2011/07/28/CompositionRoot/
  • #19: An entitys identity can cross multiple microservices or Bounded Contexts.
  • #28: Watch out for generic repositories
  • #30: IntegrationEvents
  • #34: Making behavior obvious Reducing the cost of changes Creating software developers like to work with
  • #37: Making behavior obvious Reducing the cost of changes Creating software developers like to work with
  • #39: When to use it? For the development of complex software Go DDD, go Agile! Software becomes higly adaptable Close to the Domain Expert