Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Domain-Driven Design | Additional Design Approaches
Software Architecture Fundamentals
course content

Contenido del Curso

Software Architecture Fundamentals

Software Architecture Fundamentals

1. Introduction to System Design
2. High Level Design
3. Low Level Design
4. Additional Design Approaches

bookDomain-Driven Design

As we continue developing our understanding of design principles, Domain-Driven Design (DDD) emerges as a natural next step.

Domain-Driven Design (DDD) is a design approach that places the business domain at the core of the software architecture.
Rather than starting with technical considerations, DDD focuses on understanding and modeling the domain — the area of knowledge or activity in which the business operates.

Core Components

These core components operate within a well-defined domain structure, utilizing important terminologies like Subdomains, Domain Logic, and Design Patterns. These terms help categorize and contextualize the core components within the broader system.

Example

To illustrate how Domain-Driven Design (DDD) can be applied to a typical e-commerce platform, essential elements can be modeled in the following ways.

Entities and Value Objects

Entities represent core business objects with unique identities. In an e-commerce system, examples of entities include the Customer, which represents a platform user and is distinguished by a unique ID rather than just attributes. Another example is the Order, which signifies a customer's purchase, identified by a unique ID and containing details such as the purchase date, items, and total amount.

On the other hand, Value Objects capture specific properties without unique identities. For instance, the Address value object stores location details for a customer, while the Price value object represents the monetary value of a product or order item.

Aggregates

Aggregates group related entities and value objects, enforcing consistency within their boundaries. In an e-commerce platform, the Order Aggregate contains the Order entity along with order items and details such as shipping and payment information. Changes within the order, such as item quantities or status updates, are managed consistently within this aggregate. Similarly, the Product Aggregate encapsulates the Product entity and attributes like price and stock level, ensuring controlled management of product updates.

Repositories

Repositories provide methods to access and store aggregates, abstracting away the underlying data structure. An example of a repository is the Order Repository, which allows for retrieving, saving, and updating orders without exposing database details. Another example is the Product Repository, which manages access to product data and enables efficient retrieval and modification of product information.

Domain Services

Domain Services handle business operations that do not naturally fit within entities. For example, the Inventory Service adjusts stock levels after a sale, while the Payment Service manages transaction processing and payment details.

Domain Events

Domain Events capture meaningful system changes that other components may need to react to. An example is the Order Placed event, which triggers actions such as stock reduction, payment processing, and order confirmation. Another example is the Order Shipped event, which updates the order status and notifies the customer.

When organized and managed within DDD's structured approach, these core components ensure that the application accurately models and reflects the business domain. This facilitates consistency and alignment with real-world processes.

In DDD, which component represents a core business object with a unique identity?

In DDD, which component represents a core business object with a unique identity?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 4. Capítulo 3
some-alt