RST Software
Editorial Team
Magdalena Jackiewicz
Reviewed by a tech expert

Introduction to domain driven design (DDD) + glossary

#Sales
#Sales
#Sales
#Sales
Read this articles in:
EN
PL

What do global giants like Amazon, Credit Suisse, Zalando, and Vodafone all have in common, aside from their well-known brand names? They share a secret weapon that has helped them navigate the intricacies of their complex systems and achieve success in the fast-paced world of software development: domain-driven design (DDD). 

In this comprehensive blog post, we will delve deep into the world of DDD, unraveling the mystery behind this acronym. Along the way, we will introduce you to the essential terminology that underpins this powerful software development methodology. By the end of this article, you'll not only understand what DDD is but also gain insight into the tangible benefits it brings to the table. 

Whether you're a seasoned software developer or just starting your journey in the world of technology, this exploration of domain-driven design promises to be both enlightening and informative. So, let's embark on this journey to demystify DDD and discover how it can transform the way you approach software development.

What is domain-driven design?

Domain-driven design (DDD) is a transformative software design approach initially articulated by Eric Evans in his seminal work, "Domain-Driven Design: Tackling Complexity in the Heart of Software."

Domain-driven design by Eric Evans. Source.

At its core, DDD is centered around a profound philosophy: it seeks to grasp and meticulously model the problem domain, which essentially refers to the specific realm of knowledge or business activities for which the software is being developed. This approach goes beyond mere coding and encapsulates a holistic mindset, aligning technology with the intricacies of real-world complexities and the design process.

The problem space in DDD. Source.

Advantages of domain-driven design

Companies benefit from adapting domain-driven design principles mostly due to their ability to align software development with the intricacies of the business domain. Learn seven reasons why the software greats have chosen a design driven by domain.

Improved communication

Domain-driven design promotes a shared language between developers and domain experts, fostering a common understanding that bridges communication gaps and unifies technical and non-technical stakeholders in discussing the domain.

Improved collaboration

DDD encourages developers and domain experts to collaborate to better understand business requirements and ensure software solutions satisfy requirements.

Focus on business goals

Domain-driven design emphasizes business domain modeling, allowing developers to focus on business logic. This guarantees that the resulting software precisely meets company goals.

Improved code

Thanks to a shared understanding between developers and domain experts, the development process results in better, cleaner, and more reliable code, as well as repeatable design patterns.

Flexibility and adaptability

Domain-driven design provides tools and patterns for creating flexible and adaptable designs. Concepts such as domain-driven design aggregates, entities, and value objects allow developers to model complex business domains, ensuring the ability to implement changes, updates, and testing over time.

Scalability and modularization

In domain-driven design, bounded contexts and aggregates allow for easy scaling and breaking complex systems into more manageable parts.

Improved balance

Putting excessive emphasis on UI/UX may result in features that are not useful. According to domain-driven design principles, the focus is on addressing the domain requirements so that software meets all user and stakeholder needs.

Downsides of domain-driven design

Although domain-driven design presents a multitude of benefits, it is not always the best approach for every project. Here is a compilation of the most frequently cited disadvantages:

  • Expert knowledge requirements: domain-driven design can only be successful with highly experienced domain experts on board. They ensure a shared understanding of the business domain and its intricacies among developers and bridge the communication gap, allowing for more accurate modeling and implementation of core business logic.
  • Resistance to change: development teams that are used to traditional development methods may not be willing to adapt domain-driven design patterns, as this requires additional initial effort.
  • Over-engineering: with increased complexity, the emphasis on strategic design and collaboration may outweigh the benefits of DDD for smaller projects with simpler, well-defined goals.
  • Increased development time: modeling and fine-tuning of the domain model, along with the learning associated with domain-driven design concepts, may contribute to an initial increase in development time compared to more straightforward development approaches.

Domain-driven design terminology glossary

To fully benefit from domain-driven design, all team members and stakeholders need to adopt the same terminology. Below, you will find a glossary to aid understanding and applying domain-driven design effectively in software development.

Domain logic

Simply speaking, domain logic refers to the essential rules and operations of a business domain. It contains the unique knowledge and operations that enable the firm to function and succeed. Domain logic automates and enforces business rules, ensuring that the application meets domain specifications. 

Developers can construct software solutions that closely correlate with real-world business processes and needs by accurately modeling and implementing domain logic.

Domain model

A domain model is a conceptual representation of the important entities, relationships, and behaviors that exist within a certain business domain. It is an organized and graphical representation of the real-world concepts and processes that a software system is intended to handle. The domain model is often constructed using diagrams, such as UML class diagrams, and it serves as the foundation for understanding, conveying, and implementing an application’s business logic.

A domain model guides the design and development of software systems by precisely portraying the fundamental features of the business domain, ensuring that the solution matches the requirements of the targeted domain closely.

Subdomain

A subdomain is a distinct, specialized area within a larger business domain. It represents a subset of overall business functionality with its own unique characteristics, rules, and language. Subdomains are defined based on specific business contexts and requirements, and they provide a way to break down a complex business domain into more manageable and focused components.

A subdomain can be a specific aspect of an e-commerce platform, such as inventory management, customer relations, or order processing. Each of these subdomains would have its own set of rules, entities, and processes that are tailored to the unique requirements of that aspect of the business.

Design patterns

Domain-driven design patterns and concepts are tools that developers can leverage within the DDD methodology to create well-structured, maintainable, and scalable software systems that accurately reflect the complexities of a given business domain.

Domain-driven design patterns are reusable solutions that are employed to address frequent challenges which arise during the development of software systems that represent complex business domains. In the context of DDD, these patterns assist developers in resolving recurring issues and applying tested solutions to particular scenarios.

Strategic design

Strategic design is concerned with the overall picture, which includes the problems that a company needs to solve, the areas in which it may gain a competitive advantage, the dynamics that exist among its teams, and the software to be built.

Tactical design

If strategic design responds to the question “what needs to be developed”, tactical design is all about “how to do it.” These are detailed design decisions made at the code level, including the modeling of domain-driven design aggregate entities, value objects, and other domain concepts.

Domain events

Domain events are a key idea for representing and keeping track of important state changes or events that happen in a business domain. They let different parts of the system know about changes that have happened in the area by sending and receiving information about them. Domain events are very significant for keeping things consistent, letting different parts work separately, and supporting the idea of event-driven systems.

Domain events provide several advantages: decoupled communication, maintaining consistency, asynchronous processing, enhanced testing, audit trail and logging, and more.

Bounded context

A bounded context is an explicit set of boundaries that determines the applicability and consistency of a given model, vocabulary, and definitions. It is an essential notion for managing the complexity of large software systems, since it makes sure that the domain knowledge is well-defined and contained inside certain contexts. By removing ambiguity and promoting clarity, bounded contexts assist in addressing the natural variations in terminology and models that may occur in various sections of a system.

Bounded context. Source.

Entities, aggregates, and other domain concepts have specified semantics within each limited context, which establishes a self-consistent and well-defined space for business logic modeling and implementation. Techniques such as context mapping are used to manage the links between various constrained contexts, facilitating efficient communication and integration in complex systems.

Ubiquitous language

The lack of a shared, clear vocabulary may result in the misinterpretation of business requirements, leading to features that do not align with the intended functionality.

The term “ubiquitous language” refers to establishing a common language or vocabulary that is shared between both technical and non-technical team members. This language is used consistently across the entire development process, from discussions with domain experts to the implementation of code.

An example of ubiquitous language in domain-driven design could be the term “Order” in an e-commerce system. Both developers and domain experts would use the term “Order” to refer to the same concept—a request from a customer to purchase one or more products. Without a ubiquitous language, developers might associate it with a database transaction or general operation.

Source.

Context mapping

Context mapping is a strategic technique in domain-driven design that focuses on establishing and controlling the interactions between multiple bounded contexts inside a large software system. It entails establishing defined limits for certain models, words, and definitions within each context in order to ensure a clear and consistent understanding of the domain.

Context mapping is critical for addressing possible language or conceptual model conflicts that may develop between different components of the system. Teams can improve successful communication, cooperation, and integration by adopting a disciplined approach to context mapping, facilitating the development of a coherent and well-organized software solution that appropriately reflects the complexities of the business domain.

Entities

Entities are essential objects that symbolize concepts which are separate and uniquely identifiable within the context of business. Despite potential changes in their attributes, these entities maintain a unique identity that remains throughout their lifecycle.

Entities encapsulate both properties (attributes) and behavior, and they play a crucial role in modeling and preserving core business concepts, ensuring close alignment between the software system and the real-world entities in the domain.

Value objects

Value objects are integral components that represent descriptive aspects of the domain without having a distinct identity. Unlike entities, value objects are defined by their attributes rather than a unique identifier. They are immutable, meaning their state cannot be changed once created. Value objects are commonly used to model concepts such as dates, monetary amounts, addresses, or other descriptive elements that contribute to overall understanding of the domain.

Their immutability and lack of identity make them suitable for scenarios where equality, rather than identity, is the primary concern. Value objects play a crucial role in creating expressive and cohesive domain models, emphasizing the conceptual richness of the business domain in software representations.

Aggregates

Aggregates help organize complex business domains by providing clear transactional boundaries. They are clusters of related domain objects treated as a single unit, designed to maintain consistency and integrity. Aggregates have designated roots, serving as entry points for external access and enforcing business rules. Aggregates encapsulate entities and value objects within well-defined boundaries, emphasizing modular and cohesive design.

Domain service

A domain service is a specialized component that encapsulates domain-specific logic and operations, addressing functionalities that do not naturally belong to a specific entity or value object. Unlike entities or value objects, domain services do not have a persistent state and focus on providing reusable and cohesive domain-related functionality. They play a crucial role in maintaining a clean and modular domain model by encapsulating complex business logic that involves multiple elements within the system. Domain services enhance the expressiveness and maintainability of the domain model by isolating and centralizing domain-specific operations.

Repository

A repository is a pattern and design concept that provides a mechanism for accessing and managing domain objects, typically aggregates and entities, while abstracting away the underlying data storage details. Repositories act as an interface between the domain model and the data access layer, allowing the application to retrieve, persist, and query domain objects without exposing the complexities of the underlying storage mechanism, such as a database. This abstraction helps maintain a separation of concerns in the design, enabling the domain model to focus on business logic while providing a convenient and consistent way to interact with the underlying data storage infrastructure.

Domain-driven design example

Let's delve into a hypothetical example of a DDD and explore how a streaming giant like Netflix could harness DDD principles to enhance various facets of its business.

  • Core domain: at the heart of Netflix's unique value proposition lies its ability to deliver high-quality video content to its users through streaming.
  • Subdomains: in a hypothetical DDD scenario, Netflix's subdomains might encompass user management, content catalog, billing, subscriptions, recommendations, localization, licensing, and more. Each subdomain represents a distinct area of the business.
  • Entity: in this context, the "User" entity could represent an individual subscriber or viewer of the Netflix platform. Users play a pivotal role in numerous business processes and interactions.
  • Aggregates: for instance, within the realm of user account management, the "User" entity could serve as an aggregate root. This aggregation could encapsulate related entities like "Profile" and "Subscription." By employing domain-driven aggregates, transactional consistency is assured when modifying user-related data.
  • Value objects: value objects could embody immutable concepts within Netflix's ecosystem, such as the duration of a streaming session or a user's selected genre preferences.
  • Domain services: Netflix could employ domain services like a "RecommendationService" tasked with processing user behavior data and furnishing personalized content recommendations. These services may entail intricate algorithms and collaboration with multiple entities to ensure accurate recommendations.
  • Repository: repositories could abstract the intricacies of data storage and retrieval. For instance, an "AccountRepository" might furnish methods for saving and retrieving user account information, maintaining a separation between domain logic and data storage mechanisms.
  • Domain events: to capture significant occurrences, Netflix could utilize domain events, such as user account creation, subscription adjustments, or successful content streaming sessions. These events might trigger asynchronous processes like updating user profiles or analyzing viewing patterns for future recommendations.
  • Ubiquitous language: in adherence to DDD principles, Netflix would foster a shared vocabulary. Whether referring to streaming quality, user engagement metrics, or licensing agreements, all stakeholders - be they subscribers, users, or viewers - would employ a consistent set of terms and definitions.
  • Context mapping: Netflix's utilization of context mapping would prove invaluable, especially in domains like content licensing. By clearly delineating boundaries and establishing communication protocols, the company could effectively navigate interactions with external partners or services, ensuring seamless collaboration.

In essence, domain-driven design empowers Netflix to align its technology with the intricacies of its business, creating a more efficient, coherent, and scalable streaming service that continues to revolutionize the way we consume content.

Implementing domain-driven design

Implementing domain-driven design can be challenging due to its intricate concepts and the need for a deep understanding of both the business domain and software development.

Partnering with RST software ensures harmonious collaboration between technical expertise and business domain knowledge, fostering a shared understanding that leads to the development of software solutions precisely aligned with your unique business needs and goals. Are you interested? Just write to us via this contact form.

People also ask

No items found.
Want more posts from the author?
Read more

Want to read more?

Product Design

Event storming 101: flexible workshop approach to domain-driven design

Discover the power of event storming as a flexible workshop approach to domain-driven design (DDD). Unlock innovative design insights.
Product Design

What is product discovery workshop in Agile and how we apply it to build outstanding products

Learn about product discovery in Agile for exceptional product development. Elevate your Agile process with expert insights.
Product Design

How to create a beautiful design system in 11 steps?

Discover the essential steps to create a stunning design system for your software projects with our comprehensive guide. Elevate your UI/UX game and boost productivity.
No results found.
There are no results with this criteria. Try changing your search.
en