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

Testing a class that only has one field only that is an ID number

I am trying to incorporate BDD into the teams working practices to make interactions with Business Analysts more effective. I recently asked this question: Should I pass an ID number from the feature ...
9
votes
1answer
2k 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 ...
0
votes
3answers
282 views

Should I pass an ID number from the feature file?

Say I have a domain object like this: public class Customer { private Guid _id; private string _name; private Address _address; public Customer (Guid id, string name, Address address)...
0
votes
3answers
785 views

DDD: Event handlers and aggregates in functional programming

When implementing a DDD driven system (based on event sourcing) using a functional programming language (Clojure), should one separate event handler functions from aggregate functions? In my naive ...
1
vote
1answer
70 views

Valid values of properties on Aggregate Roots controlled by other Domains

We are currently beginning an upgrade to our system and have decided to follow DDD methodology. The system is highly customizable by the users to allow them to tailor the software to their specific ...
2
votes
2answers
452 views

How does “Composition Root” DI apply to Domain Driven Design?

I'm confused about applying the "Composition Root" (CR) to create aggregates in DDD. Seemann (2012) defines CR as a "(preferably) unique location ... where modules are composed". He argues for ...
3
votes
2answers
235 views

Why does BDD advise an outward in approach to testing?

I am trying to decide whether BDD is suitable for my project or not. I was reading about BDD here: https://en.wikipedia.org/wiki/Behavior-driven_development and here: https://agilewarrior.wordpress....
2
votes
1answer
34 views

Advice on AggregateRoot boundaries

I am confused on how to apply DDD principles for the design of domain entity clusters with Aggregate Root. According to my understanding, Aggregate Root enforces business validations and all entities ...
3
votes
3answers
2k views

Data Entities, Domain entities and the repositories

I'm trying to get my head around DDD but I'm stuck. This is how I setup my project: Data Access Layer -Entity models that map to the db -Db connection stuff -Repositories implementations Domain ...
1
vote
1answer
437 views

Naming a Domain Model project

This question follows on from my other question here: How does an isolated class (or group of isolated classes) fit into a Domain Model? I have looked at a few domain models online: https://github....
3
votes
3answers
172 views

How does an isolated class (or group of isolated classes) fit into a Domain Model?

I am trying to refactor a large and complex application to use DDD principles as and when I get time. I have a class, which is completely isolated from the domain (it is only used by an application ...
2
votes
3answers
570 views

Who owns the Orders in a consumer-provider marketplace like platform?

We are developing an application where providers can offer their products and consumers can buy them (sort of marketplace). We try to apply DDD concepts into our model design and the implementation ...
2
votes
6answers
240 views

Should I use a collection property if I only require an object at the moment?

Please see the class below: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public string FirstName { get; set; } public ...
3
votes
1answer
1k views

DDD - Are 'use cases' and 'application services' different names for the same thing?

I'm struggling a little bit with Domain Driven Design because there are so many names and concepts to grasp. Today it striked me to know what is exactly the difference between an 'application service'...
0
votes
0answers
46 views

Different kind of settings and Settings manager persistence

I am hesitating what implementation way to choose in the following case. I have a SettingsManager public interface SettingsManagerContract { public void setStringValue(String key, String value); ...
6
votes
3answers
449 views

How do I avoid implementing my Event Sourced projections twice?

I'm currently teaching myself event sourcing and have got the concept enough to start developing a dummy app in C# and EventStore. My app is an easy-to-understand bank account system. If we model a ...
0
votes
2answers
413 views

Including aggregate data in web service response in DDD

I've been struggling with this issue for a while. Let's say you have a business application that has a rich domain and in one of the front-end views you show a list of open Orders. In this view you ...
3
votes
3answers
240 views

With event sourcing, how to get the response of a call that is a side-effect?

Let's say my user requests my ES/CQRS system to open a support ticket: The controller sends an ask-support command, this command checks if the user has enough credit to do that, then emits an asked-...
0
votes
3answers
181 views

Value Objects member used to validate another value object

Please see the code below: public sealed class UKCurrency : ICurrency { private static readonly int _decimalPlaces=2; private static readonly decimal[] _denominations = ...
1
vote
2answers
124 views

Naming relationship aggregates

Sometimes it is pretty easy to find very natural concept to represent relationship, for example Person and Team can be connected by Membership, but occasionally it is not so easy and the concept might ...
-2
votes
4answers
123 views

One Single Table or Two Smaller Tables

We currently have a Users table in the database, this has quite a few columns in it. Around 50% of the columns are barely used in the system (only on one or two pages). We've been discussing amongst ...
1
vote
3answers
598 views

Applying DDD, is having multiple aggregates representing the same concept from a different view a good idea?

We're completely remodelling a system at the company for which I am currently working. We're applying DDD and for the very first time I have actually got someone on my team who has some prior ...
1
vote
2answers
240 views

Should a REST CRUD Service that accesses a DB have 3 versions of its model

I'm building a REST service in java that does basic CRUD operations on Customers. The easy way would be for me to create one Customer model, and annotate it with JPA annotations so my persistence ...
0
votes
1answer
234 views

DTO to hold disparate data from domain model?

I have a neat domain model that makes it easy to communicate with an external web service. New requirements have made the external web service's interface messy and now I have to gather data from ...
2
votes
4answers
704 views

Should the Data Model be identical to the domain model for mapping purposes?

Say I have a data model, which looks like this: public class DataCustomer { public virtual System.DateTime CreatedTime { get; set; } public virtual Guid Id { get; set; } public virtual ...
2
votes
3answers
375 views

Domain driven design - Address entity / value

I have an address as part of my domain. The address keeps information about country, city, zipcode, street and housenumber. It is used in multiple places - a company can have an office address, ...
3
votes
1answer
239 views

How to generate a Natural key for a Domain entity?

I was reading this question recently: ID properties on Domain objects in DDD The question talks about having an surrogate key in the infrastructure layer, which is a database ID. I use a Guid for ...
2
votes
1answer
531 views

Is it normal for a Domain Model not to have an ID?

After reading the book; I understood the following: 1) Entities should implement equality and compare by ID. 2) Value Objects should implement equality and compare by all properties in the class. I ...
3
votes
1answer
280 views

Can an Aggregate Root change the 'root' of an Entity?

I have some doubts with Agreggate Roots and working with Entities. Imagine we have a Box object, which contains Potatoes. In this case and in a DDD point of view, the Aggregate Root would be the Box ...
0
votes
1answer
202 views

Passing an object instead of parameters

Please see the code below: public class Person { public DateTime DateOfBirth; public List<Offer> Offers = new List<Offer>(); public Person(DateTime DateOfBirth) { int ...
5
votes
1answer
250 views

Where does business logic go that involves multiple aggregates?

I'm still a beginner when it comes to domain driven design, and I am trying to model something like an RPG's battle system as a bounded context. I am trying to model a bounded context in which a ...
3
votes
2answers
395 views

DDD creating an aggregate in response of an event on another

I am looking at a scenario for creating an aggregate instance from a trigger an a different aggregate. I've incorporated some logic in my DDD and Event Sourcing with Onion architecture learning ...
2
votes
1answer
6k views

Project Structure of Domain Driven Design in maven Java Spring-Boot [closed]

My team is in dilemma, we have an existing maven spring-boot Java8 project with following onion architechture. controller --> service --> dao --> jpa repositories ...
1
vote
1answer
451 views

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

Please see the code here using System.Collections.Generic; namespace DddInPractice.Logic.Common { public abstract class AggregateRoot { private readonly List<IDomainEvent&...
14
votes
6answers
2k 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 ...
0
votes
1answer
40 views

Object Responsibility and Calculations

Trying to work out where certain responsibilities lie with the following example. We have a Project object and a Project can have Time entries booked against it. Each Time entry will have a no. of ...
0
votes
2answers
226 views

An aggregate without an aggregate root?

This is not a problem I am having in my problem domain. It is just a thought exercise. Say I have a simple calculator like this: public class Calculator { public IEnumerable<KeyValuePair<...
6
votes
4answers
1k views

How to implement state machine pattern on aggregate root

I am modeling an aggregate root, which has several actions that perform operations against other entities, as you'd expect. The aggregate, however, has a state, and several of these operations can ...
0
votes
2answers
238 views

Entity and Value Object are not part of the Ubiqtious language. Should this stop me from using them?

I was talking to a Business Analyst about our Domain Model a few weeks ago. I used a class diagram to facilitate communication. She understands UML at a high level and this worked out quite well. ...
1
vote
1answer
274 views

Should I handle all nine comparisons?

I was reading this article here: http://enterprisecraftsmanship.com/2014/11/08/domain-object-base-class/. The article talks about creating a base Entity class, which handles four of the nine ways to ...
2
votes
4answers
3k views

DDD: Identifying aggregate root in a simple example application domain

I'm trying to read about DDD, and i'm struggling a bit trying to to identify aggregate roots. I wrote a really simple app to divide players into different teams inside a game. So my entities are ...
0
votes
2answers
236 views

Should a Domain Object receive a list or elements of a list?

Say I have a Domain Object, which represents a Customer with a list of Offers. Say I want to add a collection of Offers. I believe I have two options: Option 1 Have the Domain Object caclculate ...
3
votes
2answers
164 views

Should a collection be encapsulated inside a class if I am avoiding Primitive Obsession?

Please see the code below: public class Customer { private readonly IList<Order> _orders = new List<Order>(); public FirstName FirstName { get; set; } public LastName ...
1
vote
3answers
902 views

In CQRS, is it okay to call external services from Sagas/Process Manager?

In my domain where I am applying CQRS, there are some external service calls in order to some validation. I am a bit puzzled about where to put these calls. I am considering to put these calls to my ...
1
vote
2answers
499 views

Should I mock a Domain Service?

I am trying to decide whether to introduce mocks in my isolated Domain Model tests. I have a class method similar to this: public Offer AssignOffer(OfferType offerType, IOfferValueCalculator ...
1
vote
4answers
201 views

Use OOP approach for organize the business rules instead of SOA in a small project. Excluding DDD, is there some strategy to do this?

I was talking with a friend another day about OOP in small projects. In the most of projects that me and him worked the SOA was the rule. Per example, imagine a Order in a SOA application. The ...
6
votes
2answers
1k views

Should Extensions methods be used for Business logic

In C# we have Extension methods. Extension methods enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. ...
3
votes
2answers
70 views

Creation of one AR causes creation of another AR

In DDD, is it okay if creation of one AR forces creation of another AR? Take for example: class User { // User related functins } class Schedule { // Schedule related functions } class ...
1
vote
2answers
108 views

Should I have a separate namespace for Domain Services?

Say I have a namespace as follows: CompanyName.TechnologyName[.Feature][.Design] Like this: https://github.com/vkhorikov/DddInAction/tree/master/DddInPractice.Logic/Atms .Design is the ...
1
vote
1answer
545 views

Is it acceptable for a Domain Entity to implement an interface?

Please see the question here: https://stackoverflow.com/questions/2352654/should-domain-entities-be-exposed-as-interfaces-or-as-plain-objects The general consensus is that Domain Models should not ...