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, Dan Haywood wrote: > On Saturday, 11 May 2013, Michael wrote: > > So, are there common opinions or even a consensus on IDs among DDD > > practitioners? > > I think the use of IDs like this is probably inevitable if one isn't > going to use an ORM, or if one is going to only use BCs as an > encapsulation mechanism and ignore modules as a lighter-weight > approach. > > So, no, there isn't consensus. > > > Is the approach in IDDD representative? > > It's a particular design. It works. Like any design, it has > trade-offs. It's not the only way. Well, that's the question, really. Are explicit IDs in the domain acceptable by the demanding standards, DDD otherwise imposes? I'd say that if IDs do not appear in the UL, they don't have a place domain code. Also, as they can be mapped to proper entities at the boundary, there is no pressing need for such IDs inside the Bounded Context. Before anyone objects to the presumed inefficiency: For the purposes of a specific BC, an entity may consist of nothing but its identity or it may load its attributes lazily. I'm not a long-time member of the DDD community and so I don't know what the actual practices are. Maybe nobody writes code like it is shown in Vernon's IDDD. But then I'd be surprised that apparently reviewers didn't object to it. Michael -- Michael Schuerig mailto:[email protected] http://www.schuerig.de/michael/ ------------------------------------