Skip to main content

All Questions

0 votes
2 answers
417 views

How to restrict the construction of a domain object to an external service?

I have this object RelativeFoo{int relativeCode, Origin relativeTo} And I want to map it to this other object AbsoluteFoo{int absoluteCode} In order to do this, I need to use a service whose ...
Douglas Monteiro's user avatar
0 votes
2 answers
1k views

Where should I put the initialization validation of a Value Object?

Hi I am making a Value Object. public class Age { public Age(int age) { Value = age } public int Value { get; private set; } } I want to check ...
honey_ramgarhia's user avatar
1 vote
0 answers
514 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 ...
Ciprian Vilcan's user avatar
-2 votes
1 answer
365 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 ...
Anyname Donotcare's user avatar
16 votes
7 answers
3k views

Primitive vs Class to represent simple domain object?

What are general guidelines or rules of thumb for when to use a domain-speciifc object vs a plain String or number? Examples: Age class vs Integer? FirstName class vs String? UniqueID vs String ...
noctonura's user avatar
  • 281
0 votes
3 answers
616 views

Assigning responsibility for cancelling an Order

During a conversation with our Domain Expert we can across this feature: A Customer service agent can cancel an Order by decreasing its quantity. To cancel an Order we decrease its quantity by the ...
Songo's user avatar
  • 6,663
7 votes
5 answers
5k views

How to model an address type in DDD?

I have an User entity that has a Set of Address where Address is a value object: class User{ ... private Set<Address> addresses; ... public setAddresses(Set<Address> ...
Songo's user avatar
  • 6,663
1 vote
2 answers
494 views

Determining the aggregates in this domain

I'm working on an ordering system where we receive tab delimited files that look like this (I removed most of the columns for clarity): OrderId OrderLineId BuyerName BuyerAdress ...
Songo's user avatar
  • 6,663
1 vote
1 answer
741 views

Refactoring the shipping application code to use DDD factories

I was trying to find examples for using DDD factories and I came across the shipping application from Eric Evans' book. However when I checked the BookingService the code to create a Cargo had this ...
Songo's user avatar
  • 6,663
8 votes
2 answers
2k views

Domain Services as facades

I read .NET Domain-Driven Design with C#: Problem - Design - Solution and I noticed that the author created a domain service for each aggregate root. However, the domain services were only facades to ...
Songo's user avatar
  • 6,663