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
1
vote
2 answers

Should the implementation of value object be sealed?

Following DDD practices, should the implementation of value object be sealed? Imagine having some abstract ValueObject and the concrete implementation given as Money : ValueObject. Should I seal Money? public class Money :…
1
vote
2 answers

Map custom list of object as json in Entity Framework

I'm practicing DDD, and I have a class which is a so called ValueObject. Inside an Entity I have custom list of that ValueObject. I'm trying to persist that collection as JSON. I have the following classes: public class User : Entity { public…
1
vote
1 answer

DDD configurable contextual validation

We have an aggregate root named Document and a value object named Metadata. There are two types of Domain users i.e. "Data entry operators" and "Regular users". When "Data entry operators" create a Document 4 fields are mandatory out of 20 fields in…
msmani
  • 730
  • 1
  • 7
  • 24
1
vote
1 answer

DDD : How to model association between aggregate roots

We have a aggregate root as follows. @AggregateRoot class Document { DocumentId id; } The problem statement given by the client is "A document can have multiple document as attachments" So refactoring the model will lead to //Design…
1
vote
1 answer

Value Objects holding Entities

In the book, Eric Evans shows an example where an VALUE OBJECT holds ENTITIES. VALUE OBJECTS are immutable, ENTITIES not. The question is: If an ENTITY that is referenced from an VALUE OBJECT change its state, was the immutability been broken? In…
1
vote
2 answers

DDD - Value Object CRUD

I am working in a task management application where users can open tickets. Each ticket has a short description field that can be chosen from a list. Backoffice team can eventually add, remove or update short description list. Changes in short…
user6279207
1
vote
1 answer

How to keep ES2015 proxies transparent in the context of object identity?

I am currently working on a "plugable", augmented run-time type system for Javascript to facilitate type-directed functional programming in untyped environments. It is essentially based on Proxy virtualization. Proxies are great, though they are not…
user6445533
1
vote
0 answers

using JSON ValueObject vs MySQL rows

Hey guys I'm having a dilemma with devising some logic for a Laravel application I'm developing and could use some advice. I have Eloquent Models A and B that needs arbitrary meta data. This meta data would not be updated frequently but may however…
Kendall
  • 5,065
  • 10
  • 45
  • 70
1
vote
1 answer

C# - Marshall by value problem!

Here is the thing, I have a problem creating a new object using the remote mechanism "marshal by value". Here is my class: [Serializable] internal class Empleado_MBV { public Empleado_MBV() { Id = 123456789; …
Diego Pacheco
  • 985
  • 1
  • 8
  • 14
1
vote
1 answer

NHibernate component mapping: Operand type clash: bigint is incompatible with time

I am writing an application which uses NHibernate mapping by code. When I have a TimeSpan mapped as a property of an entity, the TimeSpan is mapped correctly. However, if I put the TimeSpan within a component mapping (value object), I get an en…
1
vote
1 answer

How to build complex value-object?

I just have started to learn DDD. So I apologise for silly question... So I have the Post entity. It looks fine. But it should have tags. In code it looks like this (ruby code): class Post attr_reader :tags attr_reader :title attr_reader…
anoam
  • 127
  • 1
  • 7
1
vote
4 answers

DDD: Entity technically, but looks like value object?

At first let me describe a lit bit domain. We have a website, where a client can place an order. To place order, the client must provide some data. This process is divided into steps. On each step, the client provides only part of the data. When the…
1
vote
3 answers

How to create a Required Field Value Object

I'm trying to create a Required Field Value Object class that will be reusable across Entities in my Domain Model. I'm still learning the C# syntax (been coding in VB.net forever). And I'm all new to DDD (but have at least read several books). My…
Scuzzlebutt
  • 494
  • 9
  • 18
1
vote
0 answers

Doctrine ORM value object for mutiple database fields

I have the following ORM: AppBundle\Domain\ValueObject\Date\Birthday: type: embeddable fields: birthday: column: fecha_nacimiento type: datetime And I want to use this value object in two tables, the first is "User"…
Ijuhash
  • 137
  • 13
1
vote
2 answers

DDD - Update Value Object in Database with FK dependencie

I am reading about DDD and I have learned that Value Object is immutable, if you want to change it, you will have to create a new one. I have just read the information on How are Value Objects stored in the database? , it works well for…