I am working with Martin Fowler's definition as a working base.
I have a class called
Condition that I am having trouble properly classifying.
What makes me think this might be a value object:
Conditionis only valid within a context of a single entity;
conditionsare never shared, nor addressed independently.
Its equality is based on its values; ie, a single entity should not have multiple of the same
They are never modified, only added or removed from a given entity.
However, they have some characteristics not typical of value objects as well:
Very complex logic and behavior.
Potentially, references to first-class entities make up its values.
Should I be treating my
Condition class as an entity or a value?
If I do treat it as a value object, is it justified to place its data-access code in with its parent object's data-access code (
ParentEntityRepository)? How should I deal with this class differently if it is a value object?