Re: One-to-one ARs and an identity crisis
"raymond_kolbe" <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
After spending some more time at the whiteboard, I think the modeling could go either of these two ways. 1. Original model SlideShow is part of Course as well as Sessions. This makes for a fat Course AR and the one-to-one is still a smell :-/ 2. Potential model Perhaps SlideShow is a TYPE of Course. It is an OnlineCourse. And Session would be a ClassroomCourse. You could call ClassroomCourse->getUpcomingSessions(), or OnlineCourse->getSlideShow() (or model it so that OnlineCourse itself *is* the SlideShow; thus you would have OnlineCourse->getNextSlide(), etc.). I'm still very interested in what others think about this. Thanks! Ray --- In [email protected], "raymond_kolbe" <rkolbe@...> wrote: > > 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? > ------------------------------------