All Questions
Tagged with value-object domain-driven-design
30 questions
0
votes
2
answers
103
views
Modeling value object when fields' existence depends on state of other fields
I am practicing tactical DDD and having trouble as exemplified below. Fundamentally, whether some fields of the value object should be nullable depends on another field of the same value object. ...
1
vote
3
answers
144
views
DDD: big immutable item with some references to entity identifiers, should it be value object or entity?
Let's say I have a Mail, this mail have many properties given by the constructor (for example, 10-15 parameters).
This mail can't be edited (immutable), the user has specifically requested to send ...
0
votes
1
answer
348
views
In DDD, must a Value Object turn into an Entity when some limited idenifiablity is required?
I have an Entity type, let's say Car for example. There is a Value Object type Tire for it. Each car has a set of tires with certain properties. Sometimes tires are replaced, which is communicated by ...
0
votes
1
answer
792
views
Unit testing parts that use a Value Object that is being created by a Factory
Here is the conundrum,
I have a fairly complex Value Object and I don't want to expose it's internals. It should not be an Entity since there is no need for attaching an identity to it. According to ...
0
votes
1
answer
172
views
A table contains forbidden words which you cannot use in a comment - is it a value object in DDD? [duplicate]
My aggregate root is "Post" and sub aggregate is "Comment". In my database I have a table called "ForbiddenWords" with one column "Name" (it contains words for ...
2
votes
1
answer
905
views
Static validator in DDD value objects
I have a value object to hold a user id number as a string. This number has a unique format throughout my domain. So, it's being validated inside the object during instantiation and an exception is ...
0
votes
0
answers
82
views
DDD Value Objects: when is enough enough? [duplicate]
Where do you like to draw the line for modeling a single value as a Value Object v.s. a primitive? For example if I have an internal order number and a customer order number, would you model them both ...
0
votes
3
answers
1k
views
ValueObjects exposing outside domain layer
As I learned from the DDD rules, you have to change the entity through the aggregate root.
However let's say we have a value object "Address".
Is it allowed to do in the AR:
(I've seen this ...
0
votes
1
answer
669
views
List of ValueObjects a valid thing?
Let's say we have an entity Customer which can have multiple email addresses.
We create a ValueObject "EmailAddress", upon creation it checks if the address is valid.
Is this concept valid ...
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 ...
0
votes
1
answer
409
views
Should an entity initialize a value object?
I'm studying DDD at the same time that I'm reading some Khalil Stemmler posts and I'm a little confused about who should initialize the VO: the entity it is related to or the useCase that uses that ...
0
votes
1
answer
535
views
DDD - Complex value object
I have a Message class that represent some data sent by a smartwatch. A Message has a header (sender, length...) and a type; it can be a location update, an alarm message... There are about thirty ...
-1
votes
2
answers
629
views
Async Value Object Creation (DDD)
Suppose that I have a Value Object representing an Image URL of a Cake.
To check that it really is a cake, I make an asynchronous API call to a server that checks whether the image really represents ...
1
vote
0
answers
1k
views
Where to place the Value Object code that is shared by more than one Aggregate Root?
I have 2 Aggregate Root:
One is the Lessor user, and the other is the Lessee user.
class Lessor extends AggregateRoot {}
class Lessee extends AggregateRoot {}
Each of these Aggregate Roots has a ...
0
votes
0
answers
603
views
DDD Value Objects and Entity Without ORM Mapping in PHP
First, as I know, Entity in DDD is almost same with Value Object except Entity has identity. Every article I have read say same thing that entity id has ORM mapping with any ORM tool. But I don’t want ...
1
vote
1
answer
196
views
Can Value Objects create their own value?
Let's say you have a username value object which has formatting rules e.g.,
class Username
{
private $username;
public function __construct(string $username)
{
// thrown an ...
1
vote
2
answers
2k
views
When to model an aggregate's entities as part of a value object?
I've read a lot about Domain Driven Design including books from Eric Evans and Vaughn Vernon. So I am familiar with the concepts Aggregate Root, Entity, and Value Object.
But while I was modeling ...
2
votes
3
answers
3k
views
In domain driven design, is a timestamp a property or a value object?
I have some entities and some value objects that need to record the moment they were made. Now I read that a value object is a collection of properties with its own set of rules, and two value objects ...
4
votes
2
answers
4k
views
Is putting an Id to a value object a bad id?
I have a Customer which can have sereval address.
Sereval customers can possibily live at the same address.
So in my relational database a classic many to many relationship.
As :
An address can not ...
1
vote
1
answer
2k
views
How to determine aggregates when entities are shared?
So I'm trying to figure out exactly what my aggregates/aggregate roots are in my structure, and can't seem to wrap my head around it.
Database contains the following tables:
SALESGROUP
ID
...
0
votes
2
answers
176
views
ValueObject - too wordy?
So, I'm having some value objects in my domain, and when I'm using them in one of my builders it looks like this:
.withSomething(Id.of(123), Specifiers.of(MySpecifier.of("233"), MySpecifier.of("23423"...
1
vote
2
answers
2k
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 ...
10
votes
2
answers
579
views
Should well-known business ID of an entity be represented with a dedicated type in DDD/OOP?
In practical terms it means using an custom (immutable) class over a string or some other primitive type.
Examples:
Publishing: International Standard Book Number.
Finance: International Securities ...
0
votes
1
answer
403
views
domain driven design value object behavior
I recently finished Steve Smith and Julie Lerman's excellent Pluralsight course on Domain Driven Design, and I'm applying the training to a project. I have what I think is a good candidate for a value ...
8
votes
3
answers
3k
views
In domain driven design, how do I convert a database table with a primary key into a Value Object?
Lets suppose there's a database schema defined like this:
Person.mail_address_key ----- Address.address_key
Person.billing_address_key ----- Address.address_key
A Person has a mailing address and a ...
2
votes
2
answers
736
views
DDD - If an object is saved as a whole to the database, is it per definition an entity, or is it still possible that it is a value object?
I'm learning about Domain Driven Design and struggling with the question if a particular object should be handled as entity or value object.
All possible surname prefixes are kept in a database table....
4
votes
1
answer
2k
views
Use a custom value object or a Guid as an entity identifier in a distributed system?
tl;dr
I've been told that in domain-driven design, an identifier for an entity could be a custom value object, i.e. something other than Guid, string, int, etc. Can this really be advisable in a ...
6
votes
4
answers
5k
views
DDD and the persistence of value objects; must we denormalize?
I've been reading up a lot on Domain-Driven Development, and I came to the question of how to preserve lack of distinct identity with value objects (VOs). While in the DDD world, this is a requirement ...
5
votes
2
answers
741
views
Shouldn't Location be a Value Object?
Eric Evan's DDD book, Cargo Shipping Example, pg. 168:
Location
Two places with the same name are not the same. Latitude and longitude
could provide a unique key, but probably not a very ...
7
votes
1
answer
3k
views
Unique Value Object vs Entity
Trying to convert some entities into value objects I am stuck in a case where what seems a value object must be unique within an aggregate.
Suppose we have a Movie entity which makes the root of an ...