I'm working on a project where I had a value object (called SkillProfile
) within an aggregate. Aggregate root is the User
entity and the User
has a unidirectional one-to-one association to it's SkillProfile
. There is use case in the business where a SkillProfile
can be shared with another User
, but always as a copy (so modifying one of the profile won't change any of the other users profile). So far so good.
Now the business has the new requirement that it should be possible to see in reports which users share the same skill profile. This requirement cannot be fulfilled by the equals method on the skill profile, since there are skill profiles which coincidentally have the same values but weren't "shared" in terms of explicitly doing it. Of course the old requirement that skill profiles have to be immutable is still valid.
So here my question: Is it a good idea to invent a new field "Id" or "SharingCode" on the SkillProfile
class and therefore give it some sort of identity although it's still a value object and not an entity since it has no state or lifecycle?