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

Where do value objects come from in DDD?

I am currently working on side project to get a feel of DDD, and I am wondering what would be the repository-ish component to get my value objects from. In my marketplace bounded context, a Catalog is managed by a Merchant and contains Offers…
Mehdi.
  • 369
  • 4
  • 15
0
votes
2 answers

In DDD, how do you handle a conceptual object that is somewhere between an Entity and a Value Object?

In your domain model, how do you treat a conceptual object that is somewhere between an Entity and a Value Object? I.e, it is not small; it has many attributes, but it also doesn't have any identity or meaning in-and-of itself (i.e. equality is…
BCA
  • 7,776
  • 3
  • 38
  • 53
0
votes
1 answer

How to Persist N Value Objects in an Aggregate Root

In DDD, in an aggregate root of Person with a Value Object of Address, mapping that address to a database table is simple: just embed the attributes of the Address object into the record. But what about when the Person has a List, where the count…
BCA
  • 7,776
  • 3
  • 38
  • 53
0
votes
2 answers

Object vs Object_id injection in ddd

My question is simple what would be the best to inject the object itself or the object identifier in a ddd environment ? simple example to clarify the question Option 1 : class Car{ public function addWheel(Wheel $wheel){} } Option 2 : class…
AboElzooz
  • 309
  • 4
  • 16
0
votes
2 answers

In DDD, how to create/edit domain ValueObjects ASP.NET MVC?

We have identified a Location entity in a database as a value object in our domain (DDD). Locations are used by other domain objects, but don't really "stand alone" -- they always belong to another entity. Now we are trying to edit a list of these…
John
  • 3,591
  • 8
  • 44
  • 72
0
votes
3 answers

Domain driven design value object, how to ensure a unique value

I am building a questionnaire creator. A questionnaire consists of sections, sections consist of pages and pages consist of questions. Questionnaire is the aggregate root. Sections, pages and questions can have what are called shortcodes which…
0
votes
1 answer

Domain model validation, inheritance and testability

The Situation I'm building a C# web application and I want to model my app configuration as an explicit dependency to be handed in through the constructor of a service instead of relying on System.Configuration.ConfigurationManager directly in each…
mfeineis
  • 2,607
  • 19
  • 22
0
votes
1 answer

Accessing AR from value object

I have a quite difficult problem to solve. In my model I have AR Unit, AR Stage and VO GoToPositionOrder, that implements Order interface. It works like that: I create order: order = GoToPositionOrder(Position(Point(3, 4))) I give it to unit:…
Rafał Łużyński
  • 7,083
  • 5
  • 26
  • 38
0
votes
1 answer

Spring MVC form validation using Value Object

While performing Spring MVC + Hibernate validation, the ValueObject is creating a problem. I am not allowed to use my Entity Objects directly in controller, so the ValueObject is created for each entity. But now I need validation, in which I need…
TheManish
  • 183
  • 1
  • 15
0
votes
3 answers

Why are value objects immutable and copy-by-value?

According to Wikipedia's article on value objects, C# value objects are both immutable and copied attribute-wise. If they're immutable, why make copies? Even if it helps memory locality, is that general enough of an optimization to make it the…
leewz
  • 3,201
  • 1
  • 18
  • 38
0
votes
1 answer

Value object or not for 3d points?

I need to develop a geometry library in python, describing points, lines and planes in 3d space, and various geometry operations. Related to my previous question. The main issue in the design is if these entities should have identity or not. I was…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
0
votes
1 answer

Converting POPO/Value Objects to Dictionaries in Python For Use as kwargs

I have a method that returns a value object of a class like so: def get_val_obj(): return SomeValueObject() I have another method that takes a dictionary and also keyword arguments: def some_other_method(some_dict, some_other_argument,…
user1087973
  • 800
  • 3
  • 12
  • 29
0
votes
3 answers

Value objects in DDD

I have Order and OrderType classes in my sale module, that OrderType class uses for some categorization goals and applying some business rules on Orders. each class has its own table. I want to apply DDD techniques on my project. So, I think that…
Masoud
  • 8,020
  • 12
  • 62
  • 123
0
votes
2 answers

Create an object of the same class: Javascript prototype, private members, inheritance

Some code may say more than a thousand words: /** * Represents an amount of a resource * @param {number} amount * @param {string} type */ function Resource(amount, type) { var nAmount = amount; var sType = type; if (amount < 0) …
0
votes
1 answer

Entity, Value Object or what is it and where it should be?

I have class called 'Tool'. Tool has properties like: Name, Description and some specific others. Tool is special because Name and others are read only but description can be modified by users. Count of tools is constant and known at development…
dariol
  • 1,959
  • 17
  • 26