Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
2answers
665 views

Putting it all together - DDD, CQRS, Web API

I need some expert guidance. I'm trying to learn the concepts as well as implement them, and it's possible I might be over-engineering some. But that's OK, because I am wanting to learn and gain ...
4
votes
4answers
1k views

Mapping API models(DTOs) to rich domain models

How to implement HTTP's PUT that works with child collections when using DDD's rich domain models? Let's say we've got an aggregate root with a nicely encapsulated collection of items: (I omitted ...
2
votes
5answers
168 views

Is a point drawn on a canvas considered an entity in domain driven design?

I'm reading on DDD and came across this excerpt: Let’s consider a drawing application. The user is presented a canvas and he can draw any points and lines of any thickness, style and color. It is ...
1
vote
1answer
382 views

DDD Relations between child entities / value objects

I'm new to DDD and trying to wrap my head around it by writing a prototype for an application (Core-Logic-Layer). My domain model looks like this atm. (I leaved out parts, that weren't necessary for ...
0
votes
1answer
210 views

What is the correct granularity for events in the context of designing a rule-based decision system?

Introduction We need to design a system that, given a set of events that are happening in the source application, reacts to them and if some conditions have been met, actions can be triggered. Users ...
2
votes
0answers
122 views

UI syncing in case of bulk operation api

In a CQRS system, the convention that we follow is we render the detail view of an aggregate(i.e getById) using the write model and views containing multiple aggregates(like a dashboard) using read ...
2
votes
0answers
115 views

How to design a sync api exposed to third party which involves a business transaction across aggregates?

Business Domain In the Sales domain, I have 3 entities - Lead, Contact and Opportunity. A lead is injected into the system from many sources and nurtured. If it is a prospect then it is converted ...
0
votes
1answer
62 views

Is changing the domain according to the user privilege on specific fields considered as anti-pattern?

Is changing the domain according to the user privilege on specific fields considered as anti-pattern? My case: I have Schedule Entity (aggregate root) like this: public class Schedule : Entity<...
3
votes
4answers
1k views

Command handling fail feedback with CQRS

We are developing some context using CQRS approach. We have ended up with command handlers emitting events. It seems to be not a good idea to us. However we can't find any alternative approach. We ...
2
votes
1answer
811 views

Modeling request/response in domain driven design

Say I have a class of User and that user has an Id & Name, in request response modeling, I would make a request with Name on it and a response with Id and Name, thereby my domain model would be ...
1
vote
3answers
279 views

Event Sourcing - Reconstituting Aggregate from Wrong Event Stream

I am working on a project to help learn DDD and am trying to do CQRS and Event Sourcing. Code is in C#. For this example, lets say I have 2 aggregates, Customer and Product. My aggregate repository ...
2
votes
3answers
132 views

How are new bounded contexts deployed, and bugs fixed, in message-driven “autonomous” microservice architectures?

I'm coming from the monolith background, using a single large relational database. From my research, many proponents of the microservice architecture favor the event-driven rather than REST driven ...
4
votes
2answers
453 views

Deconstructing monolith software bounded contexts for domain driven design

I'm starting to dive into domain driven design for a new project. The software solution will be used by several departments to assign tasks to their employees. The task assignment process is mostly ...
0
votes
1answer
704 views

What is an example giving the difference between Domain Model and Data Model?

I've seen many articles describing differences between Domain Model and Data Model. However none of the articles have picture representations showing difference. https://stackoverflow.com/questions/...
0
votes
1answer
344 views

Dealing with eventual consistency when persisting and publishing events

Currently working on a DDD application that is using event sourcing with redis as my main persistence store. So unfortunately I do not have built in rollbacks should something fail. The application is ...
2
votes
4answers
185 views

Dilemma during designing a domain model

I have a class Document and document has a status: public enum DocumentStatus : byte { Incompleted, Completed, Cancelled } Now I have a dilemma I can't solve alone. Should Document have ...
1
vote
1answer
284 views

I need Auto-incremental like key but how?

I have a business specific pattern for storing their IDs. It's in the format of yy-mm-autoincrement. I could just store date and incremental id but there's another problem. It should be restarted ...
3
votes
1answer
285 views

DDD Application Service Architecture Question

I often run into this decision making scenario of where to call a Domain (or Application Service) when building my Domain Models. Maybe the confusion is in identifying whether this is a Domain service ...
1
vote
1answer
513 views

DDD - Aggregate Root get reference to another Aggregate Root

I have 3 ARs: Student Guardian Business Rule: Student should have at least 1 authorized Guardian Entities should not be in an invalid state right? Right now I enforced the invariant in my Student ...
1
vote
2answers
152 views

Practices for encapsulating collections in aggregate roots

How exactly should AddSomething methods in aggregate roots look like? Should I construct the objects in a call to the method, or should they be constructed inside the method?: For example: public ...
0
votes
2answers
432 views

CQRS, Where exactly is business logic that coordinates between aggregates?

Where exactly to put business logic. While everyone said put it in the aggregate. Yes, But what if business logic need datas of multiples aggregate? Or if business logic need to update multiple ...
4
votes
1answer
143 views

Repository Pattern whith complementary objects (agregates)

Refactoring an old API into a new one, because of several tools using it (admin and some mainteinance scripts) and compatibility with older versions reasons the database structure must remain the same....
0
votes
0answers
236 views

Clarification on the Onion architecture's Domain Service and Application Service

I am studying Onion Architeture but i got some doubts: All the samples (github) I found over internet are too simple, or are implemented under DDD (which I have not studied at the moment) so I can ...
0
votes
1answer
90 views

Event Store deals with Domain events or representation of domain events

I am starting a new DDD architecture and I have a dilemma with Domain Events and the way they're retrieved and stored in an EventStore database. First of all, should the EventStore live in the Domain ...
1
vote
2answers
789 views

DDD Best practices

I'm developing some test web-project for my self to learn DDD and good architectural practice at all. So application, basically, is a simple photo manager. I'm developing 3-tier architecture and for ...
0
votes
3answers
188 views

Base class responsibility

can base class contain protected methods that are not to be used by all descendant classes? I have this situation: EntityA: has some methods that handle activities EntityB: has some methods that ...
0
votes
1answer
113 views

Event sourcing and criteria based searching

I have done a lot of reading about Event Sourcing in my spare time recently. I understand that it is for situations (Bounded Contexts?) where the business is interested in how an entity arrived in ...
0
votes
3answers
508 views

Can Aggregate Root Factory create the root, and it's internal classes?

Currently, my aggregates and value objects have protected constructors and some of them are being created by static factory methods inside the aggregate with descriptive names. It creates a nice DSL ...
2
votes
2answers
966 views

How to get in touch with another Bounded Context w/o REST API?

Question: If I have to fetch an entity from another Bounded Context in order to map it to something in this Bounded Context, how would I go about doing that? Do I call the foreign Bounded Context's ...
3
votes
2answers
509 views

Application service - part of Bounded Context?

I am having a hard time understanding where the Application Services fit in with DDD and Onion architecture. Up until a few days ago I thought of them as part of domain model, but I began to question ...
1
vote
1answer
338 views

Domain driven design - factory with cross-cutting concerns

I was recently tasked with creating a factory that processes webhook events. Any authorized application in the solution (1 app per domain) can post any meaningful payload and as long as the event's ...
1
vote
1answer
123 views

How to model and divide DDD repository responsibility properly

I have a DDD repository for Employee entity. Employee will have some borrowed equipment from his employer. Because there will be more employee related records like work reports, wage reports and ...
1
vote
2answers
459 views

Can command handlers be separated from aggregate roots in CQRS

On one hand, the invariants should be protected (To make invalid states impossible early and preferably at compile time rather than run time), and on the other hand, passing domain knowledge out of ...
2
votes
1answer
78 views

Persisting domain state without exposing underlying provider(s)

Working on a DDD application where I need to persist state. Here's a very simple example: public interface IRoot { public int Id { get; } void UpdateValue(int value); } public interface IState {...
1
vote
1answer
79 views

Handling generic and specific implementation

Normally we have some code that is common for many (if not all) derived classes. An example would be a generic repository (where I could have a generic Add, Remove, Count, Max, Load etc, or a generic ...
1
vote
1answer
449 views

DDD - how and where change password for user entity?

I am thinking how to change password for user entity in my OOD Spring application. What seems to me to be the easiest way: Ask repository for particular user account entity Encode plain password ...
1
vote
2answers
1k views

SQLAlchemy and DDD: It's own pattern?

While reading "Patterns, Principles, and Practices of Domain-Driven Design" by Nick Tune; Scott Millett (certainly not the first book on DDD I've read) I started to understand usage of Martin Fowler's ...
3
votes
3answers
1k views

CQRS+Event Sourcing as Top Level Architecture: Anti-Pattern

I have been study DDD along with CQRS and Event Sourcing. I recently listened to a talk Greg Young gave a couple years ago where he said that CQRS and Event Sourcing are not a top level architecture ...
1
vote
3answers
302 views

Event Sourcing details in Domain Model

I have been studying DDD and have been experimenting with Event Sourcing as a storage mechanism. Prior to this (mostly CRUD-style applications with anemic data models stored in relational DBs), a "...
3
votes
3answers
744 views

Why “Event sourcing an entire system is a big mistake and considered an anti-pattern”?

Why event sourcing an entire system is a big mistake and considered an anti-pattern? And what situation it's consider an anti-pattern? Reference 1 Reference 2 Updated Question : Still don't ...
0
votes
1answer
96 views

DDD querying across domains

This is my first shot at trying to develop an application using some of the ideas behind DDD. It's a Rails monolith application (at-least for now). I know i'm not being strict with DDD, but I'm ...
0
votes
1answer
58 views

How should “preparation” and “usage” of the same data be separated in a DDD application, if at all?

In most domains, there is an app that "prepares" data, and another app that "serves" the prepared data. The data, however, is from the same Core Domain, which causes some confusion in modeling. Some ...
3
votes
2answers
179 views

How to design users class

I have been developing Cloud Broker system so I have Users. Users can register with phone number and code. How should I design the User class? Class User { public string User_Name{get;private set;} }...
0
votes
2answers
993 views

TDD with layered architecture, while only unit testing domain logic

Our project have a lot of layers, Entities Repositories UnitOfWorks Domain Services (Business Logic) Validation Infrastructure Application Services etc.. We are only writing unit tests for ...
3
votes
2answers
607 views

DDD - delegate business rule of domain object to external service

Situation: I am implementing DDD in my first project and I would like to clarify how to correctly implement strategy pattern (in my case check if API token is active). This is a business rule of ...
0
votes
1answer
392 views

Enum as part of domain - enum + extension or consolidate into one class?

I have a program where the domain is focused around programs. As part of the domain, I have a 'ProgramType', which is an enum formed mostly via a string from the database but also via a bit of logic. ...
0
votes
1answer
86 views

CQRS, Should I have bidirectional aggregate reference?

Suppose we have domain Character and Player. Character owned by Player. Player PlayerID : GUID OwnedCharacterIDs : Guid[] Character CharacterID : GUID OwnerPlayerID : GUID While my ...
0
votes
2answers
865 views

CQRS, How to query aggregate root using others fields rather than GUID (ID)?

There are many CQRS frameworks and event store libraries. All of them use GUID as aggregate root's ID. Those event store only let me query only by GUID. I realise that there are many times in last ...
1
vote
0answers
213 views

Are constructors with complex initialization logic always bad? [duplicate]

I've recently read this blog post regarding what a constructor should do and I am also reading Eric Evans' book on Domain Driven Design. Both the blog post and the book state that a constructor ...
1
vote
2answers
227 views

DDD domain identifier implementation should be ValueObject?

In DDD we defined domain's identifier as ValueObject. Regard here How ever in last project I implement those ID like so public struct UserID { public readonly string GUID; } public struct ...