One-to-one ARs and an identity crisis
"raymond_kolbe" <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
I'm going to be honest, I have a couple of hunches about what my issue(s) may be, but need some help. I have Course, SlideShow, TestMaster, and Session entities. I *thought* that Course, SlideShow, and Session were their own ARs, and TestMaster was part of SlideShow. Here's why: A Course is a simple container with a CourseId that has a description and "Offerings". Offerings is a simple value object. It answers the questions "is the course available online" and "is the course available in the classroom". That's it. However, a SlideShow *only* exists if the course is available online (more accurately it is only "enabled" if offered online). A SlideShow is a one-to-one with the course. Currently I create the SlideShow when the event "CourseOfferingsChanged" is triggered and add it to the repository (persistence uses transactions and UoW). Also, I'm not sure what the identity of a slide show is. I have been using the Course ID--this is how I currently look up the SlideShow from the repository. How can SlideShow be its own AR? I am updating 2 ARs (read: what I thought/think were/are 2 ARs) in a single transaction, and SlideShow *only* exists when the Course exists AND Offerings contains the option "is online". Also note that in-classroom sessions are accessed via the repository and created via client code using simple class construction (e.g. new Session($courseId, $date, $duration, $signupClosesOn, etc...)). Q. Am I correct in thinking that SlideShow as its own AR is a smell? Q. How does one reconcile this relationship?