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

  • Protect Your Invariants!
  • Protecting Your Domain-Driven Design from Anemia
  • Building A Simple AI Application in 2023 for Fun and Profit
  • A Data-Driven Approach to Application Modernization

Trending

  • Debugging Core Dump Files on Linux - A Detailed Guide
  • Automatic Code Transformation With OpenRewrite
  • How to Convert XLS to XLSX in Java
  • Testing SingleStore's MCP Server
  1. DZone
  2. Data Engineering
  3. Databases
  4. A Typical Bounded Context in Domain-Driven Design

A Typical Bounded Context in Domain-Driven Design

How should your bounded context look like? What classes can talk to which classes? What are the layers we can think of and which layer is responsible for what?

By 
Trinadh Chakravarthi user avatar
Trinadh Chakravarthi
·
Aug. 23, 21 · Analysis
Likes (7)
Comment
Save
Tweet
Share
5.4K Views

Join the DZone community and get the full member experience.

Join For Free

As Martin Flower has said, Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams.

Having said that, many people design their APIs in their own way, and, probably we end up mixing the legacy thought process of design into the microservices world which may cost us in performance and adaptability, scaling.

How should your bounded context look like?

What classes can talk to which classes?

What are the layers we can think of while designing and which layer is responsible for what?

Let's deep dive now...

Bounded Content With Classified Layers

Below is a pictorial representation of bounded context with classified layers:

Bounded Content With Classified Layers

Clients would be interacting with our application over gateway with all authentication and authorization principles.

Ideally, we categorize all our classes into 5 different layers:

  1. Distributed Services Layer (REST)
  2. Application Layer
  3. Domain Layer
  4. Persistence Layer
  5. Cross Cutting Layers

Distributed Services Layer

This layer is responsible for receiving requests from clients and delivering responses back. This is the only layer exposed to clients, other modules, and external systems. Not responsible for processing requests.

Application Layer

  • Responsible for coordinating the use case.
  • Responsible for authorization, the User's permissions are verified before invoking a use case.
  • As a service orchestrator, facilitates the domain layer with the required information and resources.
  • Can be responsible for processing queries but not for commands.
  • Not responsible for performing any domain operations and commands.

Domain Layer

  • Heart of the application, All domain logic resides here.
  • Responsible for all domain operations and commands.
  • Not responsible for insertions, updations, and deletions.

Persistence Layer

This layer is responsible for persisting the domain objects into the persistence store like a database and get back to them when required.

Cross Cutting Layers

This can be further classified into 3 more layers

  • Cross Cutting — Communication Layer: Facilitates communication between other modules and external applications. Dispatching and receiving domain events to/from other modules.
  • Cross Cutting — Operations Layer: Provides infrastructure services for logging and audit trail, log technical and business events both.
  • Cross Cutting — Security Layer: Provides authentication and authorization services.

Unit of work and transaction scope would reside within application, domain, and persistence layers only. With this approach, we will be able to make our bounded context highly scalable and resilient to adapt to any changes in the ecosystem.

Wrap Up

Hope you find this article informative. Feel free to share your thoughts.

Cheers!

Design Domain-driven design application

Opinions expressed by DZone contributors are their own.

Related

  • Protect Your Invariants!
  • Protecting Your Domain-Driven Design from Anemia
  • Building A Simple AI Application in 2023 for Fun and Profit
  • A Data-Driven Approach to Application Modernization

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!