Questions tagged [domain-driven-design]

Domain-driven design (DDD) is an approach to develop software for complex needs by connecting the implementation to an evolving model.

Filter by
Sorted by
Tagged with
1
vote
3answers
65 views

DDD - operation on one aggregate that creates another aggregate

Let's say I am designing a TODO application and therefore have an aggregate root called Task. The business requires to keep a list of TaskLogEvent that provides them with a history of how the task ...
3
votes
2answers
109 views

In Hexagonal Architecture, can a UseCase call another UseCase?

My layers are like: Controller (Http) -> Use Case -> Domain Services Imagine that I have a PurchaseController which is just getting the parameters from the Http Request and calling the ...
0
votes
1answer
49 views

Solving Event Dependence in Event Driven Systems

There are 60 Million Shipments per day. Each shipment has about 50 metrics to be calculated. Each metric is calculated based on a type of the event(Let's say event_1 has the required information to ...
7
votes
2answers
3k views

What do I use as an alternative to Domain-Driven Design, if I cannot define a Competitive-Advantage area of my system to apply it?

From all I read and watch, Domain-Driven Design (DDD), is a costly and time-consuming endeavor. In fact, everyone I have seen, including Eric Evans and Greg Young, say, don't use DDD except where you ...
1
vote
2answers
88 views

DDD: delete tree “Node” should check for children

I have a tree of Installations: Aggregate Installation has a property ParentInstallationId. I also have a RemoveInstallationCommand --> repo.GetInstallation(x).Remove() Now, I want to throw a ...
0
votes
2answers
63 views

How to check if the command is execuable when it delivers through asynchronous message queue?

The aggregate root's state is the product of the commands it receives. So different order of receiving the commands produce different aggregate root states. How can I check domain rules based on the ...
1
vote
1answer
68 views

How to split Aggregate Root that have equal identity?

In DDD, creating smaller aggregates is encouraged where possible, but in a system we are designing we are running into an issue regarding the identity of aggregates. The system evolves around ...
0
votes
0answers
21 views

How to manage race condition for a certain period of time? [on hold]

A single user may request for going to vacation or mission by a web application over REST and then AMQP . The vacation/mission request times should not overlap(the overlapping requests should be ...
0
votes
3answers
78 views

DDD and Infrastructure micro-Services - how should the interface be designed?

We've extracted our email sending into an EmailService - this is a microservice that provides resiliency and abstracts the email logic into an Infrastructure service. The question is how the ...
0
votes
1answer
39 views

DDD and CQRS - Define an entity for Scheduling use case

I have a use case of scheduling a person to some work for some time range. Eg. A service for assigning a person A to work for time range X to Z in location C. The only constraint it has, is one ...
0
votes
0answers
36 views

In a DDD CQRS API, is it preferable to have a separate DTO per query or per representation of a resource?

I am in the middle of starting up a new project and just wanted some reassurance as to which approach to DTO's returned by the read-side was easier to maintain in a real world application with ...
0
votes
2answers
74 views

Entity unique identifier in domain driven design

I'm just learning DDD and a question raised in my mind about unique identifiers in an entity. Consider this simple method that checks the uniqueness of an entity to prevent duplication: private ...
2
votes
3answers
95 views

Serialization of messages on a servicebus and microservice architecture

In a microservice-based system, it exist some principles. Sam Newman often refers to them as these: You should always model your application around the domain A culture of automation. Automate whats ...
-1
votes
1answer
51 views

What is the best design for this use case regarding bidirectional relationship? [closed]

For this question let's consider a system in which the users can match with each other (let's say for simplicity exactly like the dating apps). User1 matches User2 (and the other way around) only in ...
1
vote
1answer
748 views

Should I have an interface or class for my aggregate root?

Please see the code here and specifically using System.Collections.Generic; namespace DddInPractice.Logic.Common { public abstract class AggregateRoot { private readonly ...
2
votes
1answer
49 views

DDD: Type hierarchy of entities' property

Say I have an Delivery class which should have a Destination property (among many others). Destination can be an Address (country, city, address line, post code) or a Port (international code, name). ...
1
vote
1answer
44 views

Using a different bounded context's root as another root in DDD

I'm not sure the best way of phrasing the question, but let me explain! Say I have a bounded context of Customer. I then want to create another bounded context around subscriptions. Normally I would ...
1
vote
2answers
112 views

Would I have one domain model (.NET Project) for all consumers or one domain model (.NET Project) per consumer?

Say I have a bounded context called: 'Loans' and the following APIs: HSBC NatWest TSB The three banks above are consumers and have an API. I am using the scatter gather pattern (https://www....
0
votes
1answer
500 views

Confused about commands, domain events and external events in event sourcing

I'm a little confused about commands role in event sourcing distinction between domain and external events If my understanding is right a command represents an action initiated by an actor in terms ...
0
votes
1answer
61 views

Update Entity for Repository Pattern and UOW Pattern C#

In one mock solution, I have created 3 mock projects to implement layered architecture design mainly the - Presentation Layer (Web) - Domain Model Layer - Infrastructure Layer. I haven't yet to add ...
2
votes
4answers
395 views

How to handle business rules that are really unique constraints?

In a hypothetical system that handles adding users, there are several business rules. Some of the rules can easily be checked in the model. For example a user registration can only be saved if they ...
0
votes
1answer
216 views

How to document the outcome of an event storming session

It's been a long time since I was first introduced to Event Storming in a DDD workshop. More recently we decided to apply it in practice and we have planned our first sessions with a facilitator (...
4
votes
2answers
178 views

CQRS sequential numbering of business documents

I am currently building a microservice-based system to learn CQRS/ES, Docker, AMQP and all the other goodies that goes with it. I have never asked a question online before as I am usually pretty good ...
0
votes
2answers
151 views

How to design an API wrapper with bulky operations on domain object? (Need guidance)

I need some guidance in designing an API wrapper for my backend APIs. I have tried to keep it as specific as possible. Context: We have a project which supports certain file operations like edit, ...
2
votes
1answer
137 views

Applying Domain Driven Design - Model/Implementation

I'm quite new in the DDD-World and I'm just trying to figure out all the basics so please bear with me! I have the following Entities: - Datamodel - Object Types - Object Fields A datamodel can ...
0
votes
1answer
71 views

Creation of aggregate root that contains references to other aggregate roots

I would like to model the following entities: "Person", "Company" and the aggregate that ties the two together "Membership". I have identified that Person and Company are aggregate roots. Thus, "...
24
votes
5answers
26k views

Is it good practice to use entity objects as data transfer objects?

I am wondering because if it is, why does Entity Framework not offer logic to create a new object with the same properties to transfer data between layers? I use the entity objects that I generate ...
0
votes
0answers
41 views

Design Pattern: Communication between Model-Controllers and Model-ServiceAdapters

I am trying to architect a stand-alone WPF desktop app, but the question could be applied to any programming framework. This app has an UI where user interacts to send commands and receive/view ...
0
votes
3answers
137 views

Domain Models with complex properties construction

According to this article: Using Ids in Domain Models is not a good practice. We should reference the entire domain model instead. In this case, when we want to provide only Getters for our ...
8
votes
2answers
962 views

“Implementing DDD” by Vernon: value object or not?

On page 382 of this book there is a passage talking about using value objects in aggregates, under the (entity) root. There is an example of Product that, besides other values, contains a Set<...
1
vote
3answers
111 views

How to use data from another bounded context

The applications that I work with deal with Group level insurance. The insurance is mostly Life and Long Term Disability. We have a monolith library that all of our applications use at this time. We ...
0
votes
2answers
99 views

Can a query handler (not repository) access a web service?

Say I have the following class, which maps to a database table: public class Person { public Guid Id {get; set; } public string Name {get; set; } public DateTime DateOfBirth {get; set; } public ...
0
votes
1answer
83 views

DDD persistence through non-orm tools in java

So our domain model drove our database and ORMs worked for DDD implementations. Now the tables have been altered a lot and as a consequence ORM impedence is too much in our domain model to use ...
0
votes
1answer
68 views

How to handle Domain Event handlers ordering

Background: we have 2 bounded context: Inventory and Sale application context is Point-of-sale system Scenario: When a Checkout happen on Sale BC, we would like to decrease quantity in Inventory. ...
0
votes
1answer
84 views

Side-effect-free functions and returning domain information DDD

In Domain-Driven Design (Eric Evans) the discussion on side-effect-free functions talks about separating commands which "result in modifications to observable state" from queries which have no side-...
0
votes
1answer
59 views

Storing within the domain or use CQRS?

Assume we're building a fleet management system that is monitoring telemetry on a fleet of cars. Important telemetry include like location, speed and engine temperature. Metrics are mostly dynamic and ...
2
votes
1answer
761 views

Relations between entities in DDD

I am a beginner on DDD, working around small, simple domains in order to get my head on all the principles of design. I have this simple domain: institutions (Institution) and their available WiFi ...
-1
votes
3answers
366 views

What is a CRUD system?

I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be: 1) A database driven system (website or application) i....
-2
votes
1answer
94 views

A basic question on DDD aggregates order and payment

There's is a statement from https://martinfowler.com/bliki/DDD_Aggregate.html: An aggregate will have one of its component objects be the aggregate root. Any references from outside the aggregate ...
0
votes
1answer
75 views

Keep all user orders in a single aggregate instance

I'm thinking of not keeping user orders as separate Aggregate instances, but combine them into one UserOrders. Is such an approach going to have some flaws in terms of DDD? Along with orders, I would ...
22
votes
8answers
5k views

When is primitive obsession not a code smell?

I have read plenty of articles recently that describe primitive obsession as a code smell. There are two benefits of avoiding primitive obsession: It makes the domain model more explicit. For ...
4
votes
4answers
3k views

DDD and the persistence of value objects; must we denormalize?

I've been reading up a lot on Domain-Driven Development, and I came to the question of how to preserve lack of distinct identity with value objects (VOs). While in the DDD world, this is a requirement ...
3
votes
2answers
167 views

How should domain services be referenced?

I'm working on a test project, with the intention of using DDD. So far I have this basic project structure: My question is: How should the Core.Domain.Services be referenced? do I create an ...
0
votes
2answers
100 views

F# DDD Bank Modelisation: Aggregate Design for Event Sourcing

I am designing a toy project dealing with the bank account management in F# with Event Sourcing. I would like to get a bit of review (not really a code review) about my Commands and Events to see if ...
3
votes
1answer
142 views

How do I migrate part of a business process to DDD? [closed]

I am quite new to DDD, but I am currently working on a system which has a payroll element to it. I have a requirement to send payslips to an external system when they are created. Currently the ...
4
votes
2answers
2k views

why exposing service instead of repository in onion architecture

I'm digging on how to structure projects and so I stumble into Onion Architecture. As to how I understand it, its more on a domain-centered-focus architecture instead of a database-driven type. I'm ...
10
votes
2answers
3k views

Exceptions in DDD

I'm learning DDD and I'm thinking about throwing exceptions in certain situations. I understand that an object can not enter to a bad state so here the exceptions are fine, but in many examples ...
1
vote
3answers
63 views

Event sourcing: event's data (payload) vs metadata

There is often introduced a concept of using metadata in events. I just would like to understand the difference between data (which is referred to as payload) and metadata. I've read what I could ...
6
votes
2answers
2k views

Repository pattern implementation that knows nothing about the database table and column names

I've seen around the Internet and Github, implementations for the design pattern Repository that knows about database table and column names. I was think, if I want to work with the database as a ...
2
votes
4answers
1k views

Inventory, Pricing and Product Catalog communication

Imagine that I am creating and Ecommerce application. For sake of simplicity, I will describe only 3 bounded contexts. Product Catalog: it's responsible for maintain product descriptions, ...