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
3 votes
2 answers
458 views

In DDD, is it worth it to define a Bounded Context for file access?

I'm designing an editor as a desktop application that opens, saves and saves as documents from files, something very common in fact. I already have Bounded Contexts for my business rules. Naively, I ...
user avatar
1 vote
2 answers
673 views

DDD: Aggregate root too many lines of code

I am following the DDD principles and have these Aggregate root classes. The problem is that after some time my class contains 1400 lines of code which makes development experience a little bit worse. ...
user avatar
7 votes
3 answers
381 views

Event Driven Architecture - Best Practice

I am trying to understand the best practice around the event-driven architectures. say I have 2 services order service and inventory service. An user wants to order product and sends a request to ...
user avatar
0 votes
2 answers
73 views

How can domain modelling coexist with certain database optimisations?

I'm currently working on a .NET project where we'd like to perform some computations directly on the database for efficiency (e.g. performing a join and count on the database to check if a user has ...
user avatar
  • 119
1 vote
1 answer
420 views

Upholding business logic and invariants in an event sourced CQRS architecture

My understanding of a CQRS architecture is that a micro-service is split to two servers each with its own database such that the first server handles all the writes and the second server handles all ...
user avatar
  • 13
3 votes
5 answers
330 views

How should I work around a particular "chicken and egg" problem with entity construction?

I'm struggling to think of a concise way to phrase the question, but assume you were developing an application that managed employees at various company branches. You could potentially model this part ...
user avatar
  • 439
2 votes
1 answer
381 views

Event Sourcing - More complex example

Usually when I read Event Sourcing examples - they are pretty simple. When trying to implement something even more complex - it seems to get pretty ugly pretty quickly. Let me explain this on one ...
user avatar
2 votes
0 answers
397 views

How to retrieve login token from repository in network layer? Domain Driven Design - DDD

I am trying to come up with a design for an application I am working on. Here is a basic picture of what I am looking to do. Everything up to the Data Layer is totally fine but the Data Layer makes ...
user avatar
0 votes
2 answers
281 views

Event sourcing with concurrency against projections

I'm using event sourcing in an application and constantly find a problem for which I do not find a good solution. In this scenario we have an application for a hair stylist. We have a ...
user avatar
  • 453
1 vote
3 answers
156 views

How to implement set validation in an aggregate root when you have a lot of records?

Suppose I have an inventory management software that manages an inventory of phones of many subsidiaries of a company. A business requirement for this software is that you can't register a phone with ...
user avatar
  • 163
0 votes
1 answer
279 views

Can modeling Firestore using CQRS concept will prevent from Firebase locked-in?

I decided to go with Firestore to our new project. The goal is I don't want our server logics and database designs are locked-in by Cloud Function and Firestore, And also long-term maintainability. ...
user avatar
  • 647
-1 votes
2 answers
214 views

How do we model Domain entity that has dependency on Config classes?

So for e.x I have an entity Payment and a config Payment settings. class Payment { public Payment(PaymentSetting setting, ....other fields){} internal Payment() /*strictly for the ORM**/ ...
user avatar
1 vote
2 answers
283 views

Is it acceptable to pass a "context object" through a pipeline of entities?

Overview Domain-driven design prescribes modelling a particular domain with classes that contain both state and behaviour. Microsoft attempt to support this methodology in modern C# applications ...
user avatar
  • 439
0 votes
1 answer
93 views

What is correct way to accept arguments in Domain Model when you want to add item?

I'm looking for ways how to accept arguments in the domain model when you want to add items in it. Let's take a look at this example: public class Order { public ICollection<OrderItem> Items ...
user avatar
  • 109
0 votes
2 answers
106 views

Where to place methods that consume multiple object collections

We've been battling over where certain methods should live within our domain model, so looking for some adice and reasoning as to where they should go. Say we have a Project object now that Project ...
user avatar
  • 149
1 vote
2 answers
536 views

Primitive obsession, value objects, Commands, Events and where to convert

I tried to combine two rules. Don't fall to primitive obsession (e.g. EMailAddress should be a value object in domain objects and not a string). Don't use value objects in commands and events.1, 2, 3 ...
user avatar
  • 111
0 votes
1 answer
680 views

DDD Aggregate in PHP — how to retrieve the root?

Status quo I created an aggregate, let's call it Foo. It has two entities within itself, let's call them Foo & Bar. You can mutate things by calling the aggregate's public methods. E.g. $foo->...
user avatar
  • 59
1 vote
0 answers
44 views

Specifications Pattern crossing bounded context - Domain Driven Design

I'm trying to understand and implement with good practice the Specification Pattern within my domain driven design project. I have few questions: For example: verifying that a customer is subscribed ...
user avatar
0 votes
3 answers
689 views

DDD Validator Specification with dependency on repository

I have read this https://stackoverflow.com/questions/5818898/where-to-put-global-rules-validation-in-ddd and I have create my validator. But now I need to create a validator that must check the order ...
user avatar
9 votes
4 answers
693 views

DDD in microservices - where to draw the line of responsibility of a microservice?

TLDR: If microservice A needs to combine data from services B & C (that are not aware of one another), should B (or C) do the data merging for service A, or it will be up to service A? In Details ...
user avatar
  • 261
3 votes
3 answers
2k views

Entities vs. Services in domain driven design (DDD)

I wanted to get some feedback on the design of a chat application I recently developed. The application is written in PHP, but the language probably isn't important here. The main components are User, ...
user avatar
  • 179
3 votes
4 answers
350 views

Isn't refactor on an existing and fairly new module a normal practice in software product development?

Currently when working in a scrum team in a software service company, who has a clean business domain. I am working on adding new features to an existing module. As the existing module is legacy, and ...
user avatar
  • 1,477
-1 votes
3 answers
184 views

Specialization and LSP violation?

I have Document and ExternalDocument classes in my system, where ExternalDocument extends Document. The main distinction is that ExternalDocument holds onto externalDocumentId and externalEventId data ...
user avatar
  • 321
1 vote
3 answers
868 views

DDD - How to validate an entity is valid when said entity is a different domain which i dont have access to

I am wondering how I would validate some actions in my domain when a parameter of an action needs to be validated, but that parameter's entity is actually in a different domain so I can't retrieve it. ...
user avatar
2 votes
2 answers
274 views

Bounded Contexts in Domain-Driven Design

Let's say we are in a company that sells coffe mugs, providing a Domain-Driven Design approach for their architecture needs. According to common DDD practices (i.e. in literature by Vaughn Vernon and ...
user avatar
1 vote
0 answers
219 views

DDD - Entity is shared by multiple Aggregates

i wonder what is the correct solution to ensuring consistency of a shared aggregate? Problem statement I try to model the registration at an event with reserved (and limited) seats (like shopping cart)...
user avatar
1 vote
3 answers
506 views

How does DDD play nice with dynamic business rules?

DDD was chosen as an architectural pattern to tame a wild database model, as well as ubiquitous language. However, there is a sticky part of our model -- many of the rules are dynamic, and I don't ...
user avatar
-3 votes
1 answer
92 views

How to get Address pincode inside Customer class

I have 2 domains Customer and Address using using EventSourcing and CQRS in our Monolithic app, below is my query: Customer Domain: class Customer { //Aggregate class String custId; ...
user avatar
  • 109
1 vote
2 answers
158 views

How to implement rich domain model without referencing other objects?

I have some doubts about having rich domain model without having other entity objects inside it. Let's imagine that we have a product feed with no more than 10 products. Each product is made by some ...
user avatar
2 votes
1 answer
309 views

DDD: How to properly organize hierarchy of subtypes?

I am a bit confused how should I organize code base with hierarchy of subtypes. To explain, I will demonstrate some synthetic example. Let's assume we have some kind of blog, where we can have two ...
user avatar
1 vote
1 answer
92 views

designing events for an event sourcing based application

In an application to handle employee leaves, I decided to try CQRS & event sourcing and came up with the following flow of events. app events leave-application-received leave-application-...
user avatar
  • 143
-3 votes
1 answer
399 views

Is it good practice to call service layer through domain object getters?

Tell me anybody, is it good practice to call service layer methods through domain object getters? Let me show you with an example: public class User { private long id; private String name; ...
user avatar
  • 3
2 votes
0 answers
664 views

Product, Category, Attributes modelling in DDD

I'm trying to model online shop catalog using Domain Driven Design. There are three main concepts I have right now: Product, Category, Attribute. Attribute is a characteristic of a product. For ...
user avatar
1 vote
1 answer
212 views

Is there an equivalent to "aggregate" outside DDD?

Edit 2: Thinking about the problem some more I realized that "Can aggregates be used outside DDD?" was not the right question, hence I changed the title. For the reasons described on the ...
user avatar
2 votes
4 answers
195 views

Where do these queries fit into a good architecture?

I've been thinking about a problem for a while and I don't really feel that I've nailed how to approach this. I'm trying to work with DDD as much as possible but some presentation scenarios do not ...
user avatar
0 votes
1 answer
272 views

DDD bounded context between three Aggregates that share the same address entity and CQRS

We have many different aggregates that use an address entity. But we also have an address aggregate because we have a global address book as well. Aggregate Company has many Address Entities ...
user avatar
  • 461
-3 votes
1 answer
76 views

Domain Driven Design - where should I put this kind of struct?

for example: type AParams struct { a int b string c []anotherStruct ... } //domain/repo/a_repo.go type ARepo interface { GetA(params Aparams, ...) (entity.A, error) } /// infra/repo/...
user avatar
2 votes
2 answers
197 views

Updating properties with vertical slice architecture

In Vertical Slice Architecture (VSA) you are supposed to have a class for pretty much every operation you can do (as I understand it). Some example, also mentioned in the referenced article, are: Get ...
user avatar
0 votes
1 answer
50 views

How to deal with second hand reference data in event driven architectures?

What is the best way of dealing with secondary reference data in event driven architectures? For example, if you have an event from an "Employee" domain that includes some reference data ...
user avatar
  • 156
0 votes
1 answer
81 views

DDD - confused on how to implement a use case involving 2 aggregate roots

I have two aggregate roots: User and Sketches. In my application, users can clap for a Sketch. In the service layer, it looks as so: class SketchService { constructor ({ SketchRepository }) { ...
user avatar
  • 668
-1 votes
2 answers
467 views

DDD, service and localization best practices?

I'm building HTTP API with DDD principles. The end goal is that the server runs on some chosen language X but the clients can use what ever language the software supports. Service has state, but HTTP ...
user avatar
  • 233
1 vote
2 answers
315 views

Confusion about layered architecture

Given a layered architecture consisting of presentation layer business logic layer data (access) layer and a SPA web application communicating through REST endpoints with the backend (eg Angular and ...
user avatar
  • 27
1 vote
1 answer
270 views

DDD - Is creating logically dependant aggregate roots that don't make sense on their own a bad practice

I'm developing real-time chat functionality as part of an application. As per my initial structure I had 3 Domain Objects as part of this new context: Thread (aggregate root) ThreadMessage (entity, ...
user avatar
3 votes
1 answer
106 views

How to model ordering of Aggregate Roots?

Let's imagine a simple domain model: // aggregate root class TaskList( id: Long, name: String ) // aggregate root class Task( id: Long, taskListId: Long, name: String, dueDate: ...
user avatar
  • 796
3 votes
4 answers
2k views

DDD: accessing data from external service (REST, SOAP, etc.) as part of domain

I have a situation where my business logic depends on data coming from an external service. I initially though this would be a prime candidate for a domain service, but now I'm starting to wonder if ...
user avatar
  • 926
4 votes
1 answer
318 views

How far to go when decoupling Microservices by use of Integration Events (Messages)?

I am reading the architecture guide from the .net core project. They state: The integration events can be defined at the application level of each microservice, so they are decoupled from other ...
user avatar
1 vote
1 answer
1k views

How should infrastructure be able to reference repository interfaces in onion architecture?

In Jeffrey Palermo's article about Onion Architecture, he claims the following: The first layer around the Domain Model is typically where we would find interfaces that provide object saving and ...
user avatar
5 votes
1 answer
1k views

DDD: Viable approaches to integrating with external systems (Adapters, ACLs, Bounded Contexts)

Our team have been debating approaches to integrating external or third party systems when using DDD. The literature is extensive, but sometimes contradictory. Just like a UL helps us better ...
user avatar
  • 161
13 votes
2 answers
566 views

When bounded contexts and "microservices" collide. A distributed systems dilemma in diagram form

You can't please everyone. Some people want a lot of context and background on sites like this. Others do not. If you don't want the background, skip the first three paragraphs. I am a software ...
user avatar
  • 281
2 votes
1 answer
55 views

Maintaining business rule consistency and validity for Aggregate Root's child entity collection

Lets say we have DailySchedule Aggregate Root and Appointment Entity. DailySchedule AR owns a collection of Appointments. The idea is - we want to enforce the following business rule given by domain ...
user avatar

1
3 4
5
6 7
29