value-objects

create 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) { throw new IllegalArgumentException("amount has to be positive"); } /** ...

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 wondering if there's a similar library out there (developed in another language) to take i...

PHP OOP Concepts (Value Objects / Data Access Objects)

Hi, I've just started to learn PHP OOP, previously I have been doing PHP in a procedural manner. I was reading this article and I've got a couple of quick questions, How is the constructor for value objects commonly defined? As one that takes in all "data members" as parameters or stick to the default constructor and use mutator / acc...

Entity Framework 4.0 and DDD patterns

Hi everybody I use EntityFramework as ORM and I have simple POCO Domain Model with two base classes that represent Value Object and Entity Object Patterns (Evans). These two patterns is all about equality of two objects, so I overrode Equals and GetHashCode methods. Here are these two classes: public abstract class EntityObject<T>{ ...

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

Hi, 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 should be unique within a questionnaire (but not unique within the database hence they ar...

Aggregates and Value Objects: Delete?

Hi, I'm currently determining the entities, value objects and aggregates in a system. Say the following Entities have been identified: Customer, CustomerEmail, Email, CustomerAddress, Address, AddressType where Customers -> Emails is a many to many relationship, as is Customers -> Addresses (with an address type). These relationships ...

Value Objects Vs Entities...

Quick question... When approaching something like an email address the immediate idea is to treat this as a value object. If we have a number of entities though, say a customer, a contact, and a supplier that are referencing the same email address, it is conceivable that when we change a customer's email address we may want the custome...

populating and and accessing data from a value object

I have have a problem loading and accessing data from a value object in my new project.. I load an xml file via a service, which contains title and locations of asset files, I need to be able to access the location of an asset file by specifying the title and retrieiving it from a value object.. I'm using the Robotlegs framework, here's ...

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 (Plain Old Java Object) Wikipedia In computing software, POJO is an acronym for Plain ...

DDD and storing complex Value Object in db using Hibernate

In the sample DDD project written by Eric Evans (http://domaindrivendesign.org/examples) there is a Cargo class which is an entity object and is mapped to db table using hibernate. That Cargo domain object consists of several value objects one of which is Delivery. This Delivery value object is quite complex as it has some 10 fields. Non...

OOP Value Objects and Entities in the same class

I am refactoring an old procedural PHP website into a tasty OOP application with a light sprinkling of Domain Driven Design for added flavour. I keep stumbling upon cases where I have a need for classes that can have subclasses which are either entities or value objects. An url object, for example. There are a zillion urls out there an...

How to do a SELECT LIKE with PDO Prepare Statement - are value objects of any use here ?

The point is to make a query that will grab values introduced by the user on a input box, and retrieve the database records found trough that keyword comparison. On a innodb engine, so no MATCH AGAINST available correct ? I will use LIKE on a indexed column table, hope it's ok. traditionally we will do: SELECT our_column FROM our_db_t...

Containership Question

Consider this example: namespace ValueObjects { public class User { public string UserCode { get; set; } public string UserName { get; set; } } public class Company { public string CompanyCode { get; set; } } } Now, I want the User class to have a CompanyCode property.. the first obvious solution is just simpl...

When doing DDD, are there any best practices in using copy on set or copy on get, or both?

Domain Driven Design (DDD) suggests using immutable objects or to copy object state when moving data around. I see both good reasons for copying when setting data and when getting data. Take the following interfaces and pretend they have implementations: interface Aggregate { function setEntity($e); function getEntity(); } in...

What is the etymology/meaning of the term "value object"?

I am a programmer with a .NET / PHP background. I recently reviewed a video training on Flashbuilder 4 / ActionScript. One of the videos in the video training is named "Creating a Data Model with a Value Object". I mentioned that "value object" was an unfamiliar term to me and didn't really know if he meant by it "model" or not and it w...

Value Object Mapping DDD+ Nhibernate

Hello , I have already read other SO posts dealing with similar but none clarified what I wanted to do. I have MyProduct Entity and MyItem Entity. Product is made up of MyItem(s) .same like order order line scenario. MyProduct Will need to have value objects public class Item : EntityBase { public Item() { } publ...

Nhibernate Component Mapping : Parent Object null in Value Object while querying from database

Hello, I am mapping my value Object Item as component withthe folowing mapping configuration { Table("Product"); Not.LazyLoad(); Id(x => x.Id, "id"); Map(x => x.Number, "number"); Map(x => x.Name, "name"); Map(x => x.Description, "description"); Map(x =...