Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

1
vote
2answers
63 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
108 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 ...
3
votes
1answer
92 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....
-2
votes
0answers
26 views

Bulk API's handled differently than Manual Single API (DDD , Microservices)

We are building a Sales CRM type of Application where we want to provide bulk Upload API. I am using Lagom, there i cannot update multiple Aggregate in one transaction, how should i do it. I have ...
0
votes
0answers
64 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 ...
-2
votes
0answers
31 views

Should the Aggregate Repository in DDD be in application or domain layer? [duplicate]

In DDD I keep finding contradictions depending on which book/blog I look for information. In my project I have the repository interface (port) and its implementation in the application layer. It is ...
0
votes
1answer
28 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
122 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
162 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
52 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
97 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
0answers
26 views

What is the view category which Domain model of a software can be included in the 4+1 view model?

Architecture of a software can be represented using 4 views as Logical view,Development view,Process view and Physical view. I am trying to find the best group out of above 4 to include the Domain ...
1
vote
2answers
73 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
61 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 ...
2
votes
1answer
107 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
69 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
77 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
64 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
62 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
64 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
1answer
79 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 ...
0
votes
2answers
148 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 ...
0
votes
3answers
73 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 "...
2
votes
2answers
277 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
56 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
45 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 ...
0
votes
0answers
42 views

Check if exists user_id when create user

I have User class class User{ public User(string id){ this.User_Id = id; } public string User_Id{get;private set;} } When I create User in Application Layer.I am checking if exists any user ...
3
votes
2answers
158 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
147 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 ...
2
votes
2answers
83 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
109 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
49 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 ...
-1
votes
1answer
127 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
62 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 ...
0
votes
2answers
60 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 ...
0
votes
1answer
50 views

DDD in crowd voting app

As an exercise to building websites and putting DDD to practice, I am currently in the planning stages of creating a crowd voting app based on a video game I play often. The video game allows people ...
2
votes
4answers
144 views

Does CQRS need to be fire and forget, If we need to read guarantee after command?

I'm in researching phase of CQRS+ES. Never done in real world yet. But very soon. However what I saw in StackOverflow and projects, CQRS seems to be fire and forget. So what if there is a chain ...
2
votes
1answer
153 views

Use Spring JPA entities as domain model entities in DDD?

Is good idea to use Spring JPA entity classes from my data model as entities for domain model in domain driven design? Or should it be mapped into separated ddd entities. What is best practice / ...
1
vote
4answers
249 views

Separation of application logic and domain logic in Clean Architecture

I'm struggling with the separation of logic between entities and interactors or Use Cases. If I design the entities with DDD principles, each entity would have methods corresponding to use cases, ...
6
votes
2answers
402 views

Zero argument constructors and Always Valid entities

I have done a lot of reading recently about Always Valid domain entities. I have come to believe that in order to ensure the entities are always valid I need to: 1) Remove primitive obsession and ...
0
votes
0answers
80 views

Should I add XML comments in DTO models or entity models

I have 2 models, DTOs and database models (entities) that map to the database. I usually put XML comments above the properties to describe what are they for. class MyEntity { /// <summary> ...
3
votes
3answers
165 views

How can database-specific functionality, such as increment/decrement features, be used in DDD?

I have an entity that has a dollar balance property. Whenever an event occurs that causes the balance to change, such as a debit, within the same transaction the balance should be decremented by the ...
1
vote
0answers
51 views

DDD: Application Services Code Reuse

I'm struggling in how to represent and reuse some "operations" that are commonly done by the Applications Services but aren't part of the Domain. A bit of context: I implement CQRS for the ...
5
votes
2answers
376 views

Where should I put Validation Logic when using CQRS?

I asked this question a while ago: What is the "best" way to apprach validation from the perspective of a DDD purist? At the time I decided to put the validation logic inside the domain ...
5
votes
3answers
165 views

At which moment should event storming be used?

I've recently seem event storming as a quite reasonable way to get understanding form a domain, in order to build a domain model. We understand the events in the domain, which for the domain experts ...
3
votes
2answers
96 views

DDD: deciding when to lean towards eventual vs transactional consistency

I am reading Vaughn Vernon's series of articles about effective aggregate design. On the subject of deciding between transactional vs eventual consistency, it states the following: Discussing this ...
0
votes
1answer
104 views

Should the aggregate root have a property that it cannot validate [duplicate]

I ran into the situation where I have to decide whether a property belongs to my aggregate or not. My domain logic is the following. A User has a group in his organization ex: IT, SALES, MARKETING. ...
2
votes
2answers
116 views

Best practices regarding value objects

I had a few questions around value objects in DDD. I had a class ReportDefinition (basically a schema for a specific report that users can create) with the following properties (in Java): UUID id; ...
0
votes
2answers
122 views

DDD: Is there a place for “find or create” in the business logic

Some user actions quite naturally lead to find-or-create situations. For example, user logs into a system by alternative method and find-or-create is called give email. Or, another example, User is ...
-2
votes
1answer
210 views

Role-based declarative security for C#

According to Domain Driven Design and Development In Practice: Spring Security (a sub-project in Spring Portfolio) provides a fine-grained access control in both presentation (URL based) and ...