Re: IDs in the domain
Michael Schuerig <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
On Sunday 12 May 2013, Dennis Traub wrote:
> I don't think you should reference whole objects inside an aggregate
> if all you need is an identifier. Especially when that reference
> encompasses multiple aggregates.
Why is it that I "should" not do this? Is the reason conceptual or is it
an optimization?
> I understand your concern when it comes to the UL. But there's no
> need to call them {whatever}Id, you can just use a term that's part
> of the UL instead. That object then happens to contain all the
> fields required to enforce the business rules. Which in case of
> having to uniquely identify an entity might happen to be just a
> simple Guid.
We may agree here, though I'm not completely sure. Inside a bounded
context, I want to deal with domain objects, i.e. entities and value
objects. I don't want to concern myself with "entity surrogates" such as
explicit IDs. When I'm in a context where I *only* care about the
identity of an entity without regard for any further attributes, then
that is fine, too. Even if those same attributes are very important in
another context.
Michael
--
Michael Schuerig
mailto:[email protected]
http://www.schuerig.de/michael/
------------------------------------