Questions tagged [value-objects]

A value object is a fundamental concept of domain modeling in Domain-Driven Design.

A value object is a fundamental concept of domain modeling in Domain-Driven Design.

As defined by Eric Evans in his book, Domain-Driven Design: Tackling Complexity in the Heart of Software:

An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT. VALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.

324 questions
4
votes
2 answers

DDD shared entity between two aggregate roots

I'm working with two different aggregate roots: Post and Question. Both of them have a Category. So far I have implemented it as a shared entity (which I'm not sure if is a correct design in DDD). public class Post { public Guid Id { get;…
Manjar
  • 3,159
  • 32
  • 44
4
votes
1 answer

Are DTO anemic model/anemic value object?

An anemic model is a model without ... "Anemic domain model is the use of a software domain model where the domain objects contain little or no business logic (validations, calculations, business rules etc.)." Is a DTO an anemic model without…
sensorario
  • 20,262
  • 30
  • 97
  • 159
4
votes
2 answers

Spring and MongoDB: Saving Value Objects in a more flat way

For a new Spring application I'm designing and developing, we're using MongoDB as the persistence layer for a number of technical reasons. This is the first project where I'm trying to implement some DDD principles, including Value Objects. I'm…
4
votes
2 answers

Is a Value Object that is used many times an entity?

The question might not be very clear in the title, let me explain: In my model, I have an Person, that has an Address. However, many Persons can share the same Address. As I was defining my model, I assumed that Person is an Entity, but Address a…
Lucio
  • 632
  • 5
  • 21
4
votes
1 answer

Intercepting calls to defined PHP methods

I'm attempting to create a Trait to make "freezable value objects". (To avoid positional parameters and telescoping constructors.) This means the setters can be used to initialize the object, and then ->freeze() is called, which makes the object…
Jeroen De Dauw
  • 10,321
  • 15
  • 56
  • 79
4
votes
4 answers

Are these synonymous, a subset of each other or completely different?

Are the notions mentionned in the question title synonymous to a certain degree? Where do the main differences lie (context, structure, ...) and can one be considered a subset of another? Here's some brief definitions taken from Wikipedia. POJO…
James P.
  • 19,313
  • 27
  • 97
  • 155
4
votes
2 answers

Domain Modelling: Neither an Entity nor a Value Object

In DDD, the domain model consists of entities and value objects, but what do we do when we need something in the model which is neither of these? For example, I have introduced the following ScheduledItems implementation in order to encapsulate…
Dave New
  • 38,496
  • 59
  • 215
  • 394
4
votes
2 answers

Where to put the value objects in the domain layer?

Knowing that value objects represent a description of the domain, this description can be part of many entities in different bounded contexts. For example the FullName value object, this VO can live in a "book aquisition" context as member of a…
Tudor
  • 1,133
  • 1
  • 12
  • 28
4
votes
1 answer

What's the different between Value Object and a generic Class in AS3?

I don't understand what is structurally different between a Value Object and a Class in ActionScript3. Can any Class be a VO if you decide to call it one? Thanks.
Thomas
  • 5,736
  • 8
  • 44
  • 67
4
votes
3 answers

Method chaining with value objects

is it acceptable/good-practice to use the method chaining pattern on value objects (like, returning a new object instead of this)? are there cases out there where this solution is implemented ? I cannot think of any drawbacks, but I'd like to hear…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
4
votes
5 answers

Value object or entity object in my Hibernate mapping?

I'm trying to design a pretty simple app and am getting myself a bit confused with Hibernate's definition of entity and value objects (as defined in Chapter 4 of Java Persistence with Hibernate). What I have is an app with customers, who can place…
JMM
  • 3,922
  • 6
  • 39
  • 46
4
votes
2 answers

Separate table for Value Objects on NHibernate

I'm new to DDD and NHibernate. In my current project, I have an entity Person, that contains a value object, let's say Address. Today, this is fine. But maybe one day I will have a requirement that my value object (in this case Address), will have…
Bruno Reis
  • 37,201
  • 11
  • 119
  • 156
3
votes
1 answer

using List inside an entity DDD

Can we use List inside entity? or we should use them as List? When I use 'List' inside my 'Product' entity class, entity framework creates a 'Discount' table with a generated column id. Is it OK that i have defined…
3
votes
0 answers

DDD: Nested self-validating Value Objects. python

ValueObject seems so easy in theory, but I wasn't able to find appropriate solution to implement it according to DDD in python. Hope for your help ;) My valueobject's requirements: Must be immutable May be nested Can contain single value (like…
3
votes
1 answer

Using EF 4.1, can a complex type reference an entity (e.g. in DDD a value object referencing an entity)?

A blog entry I read seems to indicate it's ok for value objects to reference entities in domain driven design, and the follow-up explains how to do this in NHibernate. I would like to do the same thing using Entity Framework 4.1: specifically, have…