• About Us
    • Who We Are
    • Our Work
    • Our Clients
    • Our Partners
    • Our Blog
    • News & Events
    • Insights
  • Solutions

    Analytics & Data Management

    Big DataBusiness AnalyticsData IntegrationData Warehousing

    Digital Business Automation

    Advanced Case ManagementBusiness Rules ManagementBusiness Process ManagementRobotic Process Automation

    Connectivity & System Integration

    Agile IntegrationAPI ManagementEnterprise Service Bus

    Enterprise Content Management

    Content Capturing & ImagingEnterprise Content Management

    Enterprise Portal & Mobility

    Digital Customer ExperienceDigital Workplace

  • Industry Solutions

    • Banking >
    • Government >

    Digital Banking Transformation

    Business Process Management

    Business Rules Management

    Checks Collection & Clearing

    Counter Fraud Management

    Customer Due Diligence

    Customer Onboarding

    Daily Vouchers Management

    Debt Collections & Recovery

    Instant Payment Network Gateway

    Enterprise Content Management

    Enterprise Service Bus

    Smart Analytics

    Trade Finance Automation

    Digital Government Transformation

    Business Analytics

    Business Process Management

    Correspondence Management

    Documents & Records Management

    Enterprise Service Bus

    Pensions & Social Programs

    Social Collaboration Portal

    Strategy Management

    Utility Billing

  • Services
    • Cloud Apps & Microservices
    • IT Consultancy
    • Application Development
    • Testing Services
  • Careers
    • Careers Homepage
    • Get To Know Us
    • Engineering @ Sumerge
    • Our Culture
    • Benefits & Wellbeing
    • Job Openings
    • Graduate Programs
  • Contact Us
  • About Us
    • Who We Are
    • Our Work
    • Our Clients
    • Our Partners
    • Our Blog
    • News & Events
    • Insights
  • Solutions

    Analytics & Data Management

    Big DataBusiness AnalyticsData IntegrationData Warehousing

    Digital Business Automation

    Advanced Case ManagementBusiness Rules ManagementBusiness Process ManagementRobotic Process Automation

    Connectivity & System Integration

    Agile IntegrationAPI ManagementEnterprise Service Bus

    Enterprise Content Management

    Content Capturing & ImagingEnterprise Content Management

    Enterprise Portal & Mobility

    Digital Customer ExperienceDigital Workplace

  • Industry Solutions

    • Banking >
    • Government >

    Digital Banking Transformation

    Business Process Management

    Business Rules Management

    Checks Collection & Clearing

    Counter Fraud Management

    Customer Due Diligence

    Customer Onboarding

    Daily Vouchers Management

    Debt Collections & Recovery

    Instant Payment Network Gateway

    Enterprise Content Management

    Enterprise Service Bus

    Smart Analytics

    Trade Finance Automation

    Digital Government Transformation

    Business Analytics

    Business Process Management

    Correspondence Management

    Documents & Records Management

    Enterprise Service Bus

    Pensions & Social Programs

    Social Collaboration Portal

    Strategy Management

    Utility Billing

  • Services
    • Cloud Apps & Microservices
    • IT Consultancy
    • Application Development
    • Testing Services
  • Careers
    • Careers Homepage
    • Get To Know Us
    • Engineering @ Sumerge
    • Our Culture
    • Benefits & Wellbeing
    • Job Openings
    • Graduate Programs
  • Contact Us
Tactical Domain Driven Design

Tactical Domain Driven Design

  • Posted by Youssef Refaat
  • On June 21, 2023

In the previous article, we talked about strategic design and how it helps us construct bounded contexts, and its relationships. In the next section we will talk about Tactical design.

 

Tactical Design 

 

Tactical design is a set of tools that helps construct a Domain model for each Bounded context. It helps clarify Business entities and result in a decoupled architecture. 

 

Model Driven Design 

 

Each model can be expressed when translated to a working code as a Service. Its purpose is to serve a single Aggregate. A design that is implemented using a domain model is called Model Driven Design. 

 

Layered Architecture 

 

Creating applications that can handle very complex tasks requires separation of concerns. This is where the concept of Layered Architecture comes in. The basic idea is to structure an application into four conceptual layers. 

 

 

The “Request Handlers” layer accepts request and passes the needed objects to the right controllers. “Controllers” manage transactions, translates Data Transfer Objects (DTOs) and coordinates application activities. The “Business” layer implements the more domain specific logic. The “Persistence” layer is where the connection to the Data layer is made for persistence purposes. This allows your service to accept requests faster. It is organized, well defined, flexible, reusable, and well maintained 

 

Value Objects 

 

A general-purpose value object is designed to handle complexities and force ubiquitous language. 

A well-designed value object has these properties:

  • Does not care about uniqueness 
  • Always immutable 
  • Rich in domain logic 
  • Auto Validating 
  • Has strong equality 
  • Thread safe 

 

Entities 

 

Entities consist of value objects. They must be uniquely identified by an Id, and we must be able to persist it as a row in a Database. They are typically mutable and must implement some business logic. 

 

Aggregates 

 

Aggregates are a collection of entities and values which come under one transaction boundary. The must have a root entity in which this root entity controls the existence of the aggregate, meaning that if the root entity does not exist, the aggregate does not exist as well. The root entity governs the lifetime of the other entities in the aggregate.  

 

Repositories and Factories 

 

Repositories help you persist aggregates, and that is why there must be one repository per aggregate. Repositories contain the logic behind persisting your aggregates.  

 

Factories help create new aggregates.  

 

 

Tactical design overview

 

Strategic Domain Driven Design

Building a smart home 

 

To help clarify how DDD design works in real life, let us take an example. We are required to build a full featured smart home. The contractor says that he wants to build a very well-structured smart home and he needs most of the components to be able to communicate with each other. You start implementing right away, and you find out that there are so many questions that needs to be asked. First thing we need to know is what kind of home are we talking about. Is it a one-bedroom apartment, a condo, a standalone apartment, a Villa, or a mansion. What is the kind of components do we need. How many rooms are there, and what type of rooms? 

 

You go back to the contractor and ask him some questions. Two hours into the conversation, you feel overwhelmed by how complex this is getting. So, you go bring your Domain Expert. A domain expert is typically someone who worked on a similar matter before. He has the required business experience that can be useful to speed up this process and understand the complexity well. 

 

Our main Domain is now a Smart Villa. We break down our components until we settle on our bounded contexts. Here is a diagram showing all our BCs 

 

Each component in this diagram can represent a BC. It should have its own value objects, entities, aggregate, etc. 

 

Let us take the lighting for example. 

 

First we create a root entity that can model the Lighting in the right context. The first rule is to never use primitive data types, and instead we composite many value objects that are self-explanatory in terms of language.  

 

 

Imagine if we use float for brightness for example. This will force our Lighting entity to deal with all changes. If we want to modify the brightness class to add  intensity and color, we then only have to modify in the Brightness class as opposed to modifying the whole entity. That is the reason they are called value objects. They are objects that provide value and encapsulate a certain logic that can be described by a ubiquitous language. Any property for an entity that you can describe should be its own class, and then added as an entity variable. 

 

We are now able to see how DDD came to benefit us in designing our classes. Because we could define our domain and sub-domains, we could easily create our domain model which encapsulated several BCs and defined the relationships between them. 

 

We then could create our Ubiquitous language that made us able to name our value objects. These value objects helped us construct a well-structured entity that is consistent and easily understandable because it follows our language standards.  

 

Now let us implement a method that adjusts the brightness. 

 

This is a simple method that takes a float as an input and adjust the brightness accordingly. It first validates that the maximum intensity for the light is not violated, sets the brightness, and then returns the “this” object. We can now notice how the abstraction and intensive use of value objects helped us encapsulate our logic in an organized way. 

 

 

Summary 

 

Use Domain-Driven Design to collaborate among all project disciplines and clearly understand the business requirements. 

 

Establish a Ubiquitous Language to discuss domain related concepts. 

 

Use Bounded Contexts to break down complex domains into manageable parts. 

 

Implement a Layered Architecture to focus on different aspects of the application. 

 

 

 

 

 
Recent Blog Posts
  • Event Streaming: Enhancing Efficiency in Banking 
  • Your Guide To Integration Modernization
  • APIs: Transforming Chaos into Order
  • Event Streaming Simplified
  • Unlocking the Power of Spring Data JPA
Categories
  • Careers
  • Webinars
  • blog
    • Educational
  • Technology & Business
    • Digital Business Automation
    • /Modernization & Cloud Native Apps
    • Banking
    • Agile Integration
  • Software Engineering
    • Application Servers
    • Application Testing
    • Business Analysis
    • Frontend
    • Microservices
    • Uncategorized
  • Blog Posts
  • News & Events
  • Featured

Strategic Domain Driven Design

Previous thumb

From Legacy Systems to the Cloud: How Integration Modernization is Shaping the Future

Next thumb
Scroll
Follow us

Significant change, positive impact and passion are our fuel. We have a unique culture reflecting the way we think and act. A culture that encourages freedom and responsibility, high performance, customer centricity and innovation.

Global Locations

Egypt

Saudi Arabia

United States

About us

Who We Are
Our Work
Our Clients
Careers
News & Events
Insights

Services

Cloud Apps & Microservices
Application Development
Consultancy
Testing Services

Solutions

Analytics & Data Management
Business Process Automation
Agile Integration
Enterprise Content Management
Enterprise Portal & Mobility

Industries

Banking
Government

Latest Blogs
  • Database Events & Triggers
    December 14, 2022
  • Design Patterns
    August 23, 2022
Copyright Ⓒ 2024 Sumerge. All rights reserved.
  • Blog
  • |
  • Support
  • |
  • Contact Us
  • |
  • Privacy Policy
Sumerge
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}

     

    Book A Free Consultation Session