DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Developing and Testing Services Among a Sea of Microservices
  • Component Tests for Spring Cloud Microservices
  • Cloud Migration Checklist
  • Role of Artificial Intelligence for Government

Trending

  • SQL Server Index Optimization Strategies: Best Practices with Ola Hallengren’s Scripts
  • Analyzing “java.lang.OutOfMemoryError: Failed to create a thread” Error
  • The Role of Functional Programming in Modern Software Development
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  1. DZone
  2. Data Engineering
  3. Data
  4. DDD: Part IV (DDD and Microservices)

DDD: Part IV (DDD and Microservices)

We've all heard of the many benefits of microservices architecture, but how exactly does that relate to Domain-Driven Design? Read on to find out.

By 
M Yauri at-Tamimi user avatar
M Yauri at-Tamimi
·
Dec. 29, 17 · Analysis
Likes (13)
Comment
Save
Tweet
Share
18.9K Views

Join the DZone community and get the full member experience.

Join For Free

Finally, I got a chance to write the fourth part! For those of you who didn't get the chance to read the previous parts, you can read them starting with Part 1 here. 

In this fourth part, I will try to elaborate on the microservices architecture and its relationship with Domain Driven Design (DDD). 

Microservices Architecture

First things first: let's describe what microservices architecture is all about.

Microservices architecture is a kind of an architectural pattern that focuses on developing/building small, reusable, and scalable services. Microservices allow us to break our large system into a number of independent collaborating processes, thus it can help to avoid a big monolith application, which is difficult to maintain, especially if you have big projects with a big team.

Microservices also can be very useful when you have to create services for polyglot devices such as wearables, Internet of Things (IoT), mobile, desktop, and web.

Microservices itself is not a new term. It was coined in 2005 by Dr. Peter Rodgers, who mentioned micro web services based on SOAP. It has become more popular since 2010. 

The keys to microservices architecture are:

  1. It is independently deployable in terms of stack, framework, and/or languages used.
  2. It is deployed as a small service that keeps focusing on doing one thing well, i.e. domain-driven services.
  3. Well-defined interfaces and minimal functionality.
  4. Avoiding cascading failures and synchronous calls — reactive designing for failure.
  5. Every service has its own data and uses events/messages to communicate with other services. 
  6. Every service is deployed independently and isolated from other services (usually running in its own container) and automatically scalable.

The main goal is to provide you with a small set of independent services which run independently in different environments, but can communicate with each other (tight cohesion). As we know, coupling is a two-headed beast. On one side, tightly-coupled code is difficult to test, difficult to maintain/reuse, and typically exhibits “whack-a-mole” bug behavior (i.e. fixing one bug most likely will produce one or more new bugs). On the other side, a certain amount of coupling is also necessary since completely uncoupled code doesn’t do anything; thus, coupling is necessary but should be carefully managed. This is what we call “Loosely Coupled, Highly/Tightly Cohesive.”

Microservices Benefits

  1. Easy to scale as individual components.
  2. Easy to deploy and reduce time deployment, i.e. you can deploy each module without interrupting any other module.
  3. Easy to maintain due to its smaller code size, and you can have a small, focused team. 

Microservices Challenges

  1. It’s difficult to achieve strong consistency in distributed services.
  2. It’s harder to debug and trace issues compared to monolithic applications.

There are many other challenges that you will know yourself later, once you implement microservices. Nevertheless, it will depend on how you design and manage your microservices by following some well-known best practices, like API Management, Traffic Management, Services Monitoring, etc. I'll try to encapsulate them later in another series, if I get the chance.  

How Does DDD Relate to Microservices?

As mentioned earlier, in microservices, we build each service to serve only one thing and do one thing well. Each service is also isolated from the others. On this matter, DDD principles can help us to keep the scope of the service small through what it calls "bounded context."

Subsequently, DDD is going to help you investigate and know your domain and all subdomains well through the communication you build with the domain experts. By knowing your domain and subdomains well, you will know the map contexts and how all subdomains interact with each other, which will help you in designing and choosing the type of your microservices architecture and what kind of approaches you use to implement them, whether a reactive approach, orchestration approach, or hybrid... it will depend on your knowledge about the domain you're working on. There are pros and cons for each approach that need to be evaluated based on the project and your domain knowledge. DDD will help you make a decision on this matter.

That's all for now... please let me know if you have any more insight into how DDD relates to microservices!

microservice Web Service

Opinions expressed by DZone contributors are their own.

Related

  • Developing and Testing Services Among a Sea of Microservices
  • Component Tests for Spring Cloud Microservices
  • Cloud Migration Checklist
  • Role of Artificial Intelligence for Government

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!