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
0
votes
1 answer

Map commands to value objects in CQRS

On one hand, the invariants should be protected (To make invalid states impossible early and preferably at compile time rather than run time), and on the other hand, passing domain knowledge out of the domain is wrong. On one hand, the value objects…
Mohsen
  • 4,000
  • 8
  • 42
  • 73
0
votes
1 answer

Abstract properties as own value objects

Given the following example: class Person { Integer age String lastName String firstName } The property age should be constrained to specific validation rules: - Higher than 0 Same for the lastName and firstName: - These strings should not…
Simon Bruneaud
  • 2,263
  • 2
  • 12
  • 24
0
votes
1 answer

What are responsibilities of ValueObject

In Java, What are responsibilities of ValueObject? Is it reasonable for ValueObject to import LOGGER components?
Haven Lin
  • 176
  • 1
  • 16
0
votes
1 answer

DDD - can I use value objects as models helpers

I have an aggregate root called User. Here's an example of how it's modelised: User: { id: string username: string, email: string, auth: LocalAuth { password: string } } In my application, I have an API route - POST…
0
votes
1 answer

Am I designing and constructing my value objects correctly?

Sorry in advance if this question is unclear. Please tell me what to change to make it a better question. I am currently maintaining a C# WinForm system where I'm trying to learn and use DDD and CQRS principles. Vaughn Vernon's Implementing Domain…
0
votes
2 answers

DDD - denormalized entities as value objects with IDs?

Suppose we have an Order in a warehouse context. And we have a Client that's getting that Order. Although in the DB Client has an ID and a bunch of parameters, but I model it as a value object inside my Order: class Order extends AggregateRoot { …
Marian
  • 3,789
  • 2
  • 26
  • 36
0
votes
2 answers

DDD Remove a Text Value Object from A List of Value Object

I have entity with a list of value object like this: (I'm using Go, but I hope it generally makes sense) // this is my Crop entity type Crop struct { UID uuid.UUID Name string Type string Notes []CropNote // This is a list of value…
tama
  • 315
  • 2
  • 4
  • 11
0
votes
3 answers

DDD, Status object / Value Objects

I've a class, Proposal, which has a $status of type ProposalStatus. Now, for the most part the ProposalStatus's identity does not change... but it does (sort of). It's $id is fixed, but the $display_name and $definition (just strings) can change…
PatrickSJ
  • 510
  • 5
  • 13
0
votes
1 answer

BlazeMonster (AS3 VO/DTO Generation) support complex Java class?

Can BlazeMonster generate AS3 Value Object/Data Transfer Object from complex Java classes without issue, like enum, generic, collection/set/list/map than contain other collection/set/list/map (few levels) without any issue? Thanks.
Lee Chee Kiam
  • 11,450
  • 10
  • 65
  • 87
0
votes
1 answer

Domain Driven Design - Attributeless classes

Regarding to Craig Larmans work on designing Domain models it is valid to have classes, which are attributeless. They have behavioral roles. When defining classes as entities and value objects regarding to work of Eric Evans I cannot decide whether…
0
votes
1 answer

NHibernate: Mapping protected members in component (composite-element) mapping

I'm building an application which uses NHibernate mapping by code, and I am unable to map protected properties when I use a component mapping (equivalent to hbm composite-element mapping) for a collection of value objects. I am able to map protected…
0
votes
0 answers

JPA - How to make and Entity act like a Value Object (not using embedded)

I’m using JPA 2.1 and I have an entity object called Encounter that has one-to-one relationships with many other different objects of varying sizes (call them satellite objects). I would like these satellite objects to behave like value objects and…
Bruce_DDD
  • 95
  • 2
  • 10
0
votes
1 answer

DDD - updating nested collection of value objects throws NHibernate exception

TLDR version: I'm having trouble getting my DDD domain model to work with NHibernate. If my value object itself contains a collection of value objects, I can't assign a new value without getting an NHibernate exception, and want to know what the…
0
votes
0 answers

Immutable custom PHP array containing objects of a certain type

Firstly I want to create some sort of array that allows only the addition of a certain type of object; MyObject. Secondly I want this array to be immutable, like a value object array. I want to add MyObjects on creation, access them using a foreach…
myol
  • 8,857
  • 19
  • 82
  • 143
0
votes
1 answer

Validating value objects using annotations

I've decided to use Value Objects instead of String fields in my entity and I don't know how (and if it's even possible) to validate them using JPA Annotations like @Size, @Pattern and so on. Here is my Book entity: …
doublemc
  • 3,021
  • 5
  • 34
  • 61