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

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.

0
votes
1answer
171 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
177 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; ...
1
vote
2answers
167 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
220 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 ...
1
vote
1answer
271 views

DDD and ValueObjects in repository

I have a Product entity with a Category value object (contrived example). There's an API endpoint /products?category=Keyboards,Mice The classes at play here are the: ListProductsController (...
2
votes
2answers
371 views

Is DDD only good for batch processing?

Just read my first book on DDD ("Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#" by Scott Wlaschin in case it makes any difference), and came away with ...
2
votes
2answers
677 views

Why not use an ORM with DDD?

I've just finished reading Scott Wlaschin's excellent book "Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F#" in which he uses the F# SQL type provider for ...
0
votes
1answer
218 views

Data Mapper Pattern and DDD - Does ist already reflect domain entities and repositories?

I'm getting used to DDD so don't assume I'm a DDD pro yet. I'm trying to implement a hexagonal architecture using the CakePHP framework in a completely custom made application that just utilizes the ...
6
votes
4answers
797 views

Rich domain model vs strategy pattern in DDD

I've recently watched a few Pluralshigh courses on DDD by Vladimir Khorikov. He was encouraging to create a rich instead of anemic domain models. It all looked very nice in a small test-project, ...
2
votes
3answers
139 views

Proper layer to handle duplicate keys

In a Web Application that has 4 layers: UI layer Business layer Data Access layer Data storage layer which is the database One of the requirements is to handle a list of objects with unique key. ...
2
votes
1answer
249 views

Can one app have several “subdomains” in DDD?

General Context I started reading about layer based architectures like DDD, Onion, Clean Architecture etc. I am considering switching, but am currently unclear about how strict the "first level ...
4
votes
1answer
212 views

DDD: How to work with entity variations?

Let's say I have an Entity that represents an employee: Employee First name Last name Birthdate Hair color Eye color Gender .... (and so on) Now, imagine I have a website ...
-1
votes
1answer
299 views

How to split an onion-style DDD project without using microservices?

Background: I'm building a prototype scientific app with the "Exploration" and "Optimisation" parts. (Other parts might be needed later.) Each part uses functional reactive programming (FRP) and has ...
1
vote
2answers
102 views

How to implement Domain Model with Repository without leaking responsibility?

Imagine, we have test modules with large number of questions and we can create tests which will contain exactly 30 questions. public class Module { public long Id { get; set; } public List&...
2
votes
1answer
102 views

DDD - What could be best fit for AggregateRoot and Entity for Transaction Domain

I'll preface this question by saying I am relatively new to DDD so I may be making some fundamental mistakes here! I am working on a project which involves the concepts of Transactions (in the ...
3
votes
3answers
147 views

Handling domain errors in the API

I'm working on building an API interface on-top of a domain-driven architecture. The domain layer has a bunch of specific exception classes (i.e. NameIsRequiredException, CannotPublishDraftException, ...
1
vote
0answers
80 views

Modeling on Domain Driven Design and C4Model

I am wondering how DDD and C4Model can play together. Level 1 of Simon Brown's c4 Model is System Context diagram. So I think after you find and define your Bounded Contexts, you may start creating ...
1
vote
3answers
2k views

DDD: Is an aggregate root responsible for deleting its child entities from their repository?

I am developing a large software project using DDD (Domain-Driven Design). I have an entity that acts as an aggregate root, let's call it Root. This entity refers to a collection of child entities of ...
1
vote
2answers
226 views

In domain-driven design, are entities allowed to handle complex operations such as I/O?

Overview I'm trying to learn about domain-driven design, and I'm about 80% of the way through Eric Evan's book on the subject (and about the same on the Pluralsight course). I've been attempting to ...
3
votes
2answers
383 views

Domain Driven Design approach for game

I'm working on a realtime multiplayer game project. There are entities like Player, Game, Flag etc. And bunch of it's behaviours like PlayerRespawnBehaviour, PlayerWalkBehaviour, ...
2
votes
1answer
560 views

DDD - How to avoid overlapping aggregate boundaries?

I recently started reading Evan's book about DDD, and I decided to try and apply some of the principles from that book on a bounded context of a project I've been working on. The context of interest ...
0
votes
0answers
57 views

How to implement M-N relationship to reflect the domain correctly

If I have three entities like this: WorkingGroup WorkingTime Shift The WorkingGroup has one or more workingTime public class WorkingGroup { public WorkingGroup() { ...
0
votes
1answer
109 views

How to transform one aggregate to another in DDD

Where I work we've got wallets with transactions (i.e. every transaction belongs to a single wallet). Currently we're working on an addition of transfers between wallets. As a part of this, a new ...
2
votes
1answer
110 views

When should desktop app save to database using UoW?

So one thing I didn't really think about when designing this personal finance application was WHEN (not HOW) to persist the data. I'm using DDD, a 4-tier architecture, and EF. It struck me when I ...
1
vote
1answer
118 views

Passing Meta info from Command through Aggregate to Event

I have a CQRS system in development that passes the Command to a CommandHandler, which gets an Aggregate from a Repository, and calls a method with the properties of the Command (converted to ...
2
votes
1answer
295 views

DDD: Should create domain model for complex application layer?

I'm midway through Eric Evans' DDD book but don't think this question would be answered in the book. If an application has its own complicated concepts different from the underlying domain, can we ...
2
votes
2answers
954 views

Use a HashSet or List for a collection of Entities?

I have a class, which looks like this: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public FirstName FirstName { get; set; } public ...
3
votes
3answers
299 views

Is an Enum changing the behaviour of an Entity bad?

I am very new to Domain-Driven Design. I have come across a part of a domain which I'm not sure if I have modeled in the best way possible. There is a Membership entity which has a membership type. ...
3
votes
2answers
213 views

DDD handling of tables, repositories, and/or services

Struggling to handle aggregates and aggregate roots when it comes to persisting. For example, I currently have a repository for each aggregate/table, but this is causing some issues in my service ...
204
votes
10answers
24k views

Why do we need so many classes in design patterns?

I am junior developer among seniors and am struggling a lot with understanding their thinking, reasoning. I am reading Domain-Driven Design (DDD) and can't understand why we need to create so many ...
-2
votes
2answers
194 views

Can a Value object exist on its own?

I have read this: https://stackoverflow.com/questions/25450380/can-value-objects-exist-without-entities, which says yes and this: http://enterprisecraftsmanship.com/2016/01/11/entity-vs-value-object-...
1
vote
1answer
169 views

Deciding between a Domain Service and Entity method

I am trying to decide whether to use a Domain Service or an Entity method for a function. Please see the code below: public class Customer { private readonly Guid _id; private readonly ...
1
vote
1answer
97 views

How to verify that every object responsible for Itself

I wonder if I have multiple objects and how to list their responsibilities where every Object Must be Responsible for Itself for example: If I have three objects: Employee,Schedule,Shift. and ...
1
vote
4answers
690 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. 1. Product Catalog: it's responsible for maintain product descriptions, ...
4
votes
3answers
111 views

Model Customer preferences with different Products for Sellers

I have a model where Sellers can sell Products to Customers. Sellers need to be able to set Preferences for Customers on a specific Product. I can see how that may be confusing so let me give an ...
0
votes
1answer
234 views

Can a Domain Service Also Be a Factory?

I'm creating a domain service for each of my aggregate roots in order to facilitate some logic that won't be able to fit inside the entity themselves. I would rather not implement a factory and ...
3
votes
1answer
221 views

Should Domain Services Raise Events?

I have a business requirement that any account viewed needs to be logged. I'm trying to figure out where this requirement should be in my code. This is a query type event and doesn't require going ...
3
votes
2answers
187 views

Can an aggregate only ever consume commands and produce events?

In domain driven design based on domain events, I have the impression that several sources pronounce the rule that aggregates consume commands and produce events process managers consume events and ...
-1
votes
1answer
177 views

Using BDD and DDD approaches, which seem to complement and contradict each other

I am trying to apply BDD and DDD together to a new project The problem I am having at the moment can be summed up by the following quote (taken from here: https://www.infoq.com/news/2015/02/bdd-ddd): ...
3
votes
3answers
153 views

Should I use a physical units library for modelling domain properties if I don't need to perform computations on them?

I'm working on the data model of a service describing houses and flats. This involves storing quantitative physical properties of certain features of the premises, for example: Speed of the Internet ...
2
votes
1answer
375 views

How are CQRS write models initially populated?

I have a system that interacts with a REST API as the data source. This system is based on DDD and all of my current models are CRUD models. There is one model that the REST API is only able to query ...
1
vote
1answer
457 views

Clean architecture with C#: A better design to perform validation in Value Objects

I'm creating an application which's architecture is based on Uncle Bob's Clean Architecture concepts and DDD. Note that it is BASED on DDD, so I gave myself the freedom to differ from strict DDD. To ...
0
votes
0answers
474 views

DDD - Does Many to many relationships mean two different aggregate roots?

I'm facing the following issue: I have a very simple aggregate root Product, and a product contains Image entities. Right now in code this relationship is expressed as a Many to One relationship like ...
8
votes
2answers
3k views

Implementing DDD: users and permissions

I am working on a small application trying to grasp the principles of domain-driven design. If successful, this might be a pilot for a larger project. I'm trying to follow the book "Implementing ...
1
vote
1answer
185 views

Have I understood the term Honeycomb correctly?

Following on from my previous question and the comments under the accepted answer: One Acceptance Test project per layer or one Acceptance Test project per Bounded Context I have done a lot of ...
0
votes
2answers
92 views

How to link domain specifications with the code implementation without forcing domain expert to adopt any particular practice

Our current business process is that the domain experts will write down the business logic in a Word document, and developers will try to reflect those logic as closely as possible with the ...
-1
votes
1answer
226 views

One Acceptance Test project per layer or one Acceptance Test project per Bounded Context

This link (http://www.taimila.com/blog/ddd-and-testing-strategy/) says: "Feature tests should depend only on the application layer" i.e. presentation layer. I am trying to understand how BDD fits in ...
0
votes
2answers
301 views

How to design classes in php in respository pattern?

I use laravel with repository pattern. My project strucuture is: I have an Entity class(POPO) which implements an Interface and has a repository class related to it. For example for a User Entity, ...
-2
votes
1answer
115 views

Modeling sprint and ticket in DDD

I'm trying to learn DDD/CQRS in a hobby project. And have no prior experience. In this project I use MongoDb as a read db and EventStore as a write db. I'm building a simple 'Sprint board' ...
2
votes
2answers
797 views

Is the builder pattern applicable in domain driven design?

I asked a question on StackOverflow regarding how to 'best' use the Builder pattern for constructing a Value Object which could be constructed with or without optional parameters. One answer stated ...