The Pluralsight Domain- Based Design Fundamentals course provides an example of how an aggregate structure is formed. An example involves appointing patients to the clinic. An appointment has a relationship, for example. to the doctor or to the examination room. And this example is preceded by an analysis that Assignment should not be an aggregated root for Doctor and ExamRoom. And one step in the evolution of design comes from the Destination, which has object references to the Doctor and ExamRoom objects, to the primitive identifier of these other objects, DoctorId and ExamRoomId. They motivate this change by saying: โBy simply including identifiers of related concepts, rather than references to objects, we can ensure that the creation and change of the Assignment has a minimal impact on our system when we save our assignmentโ
My first question is: is this a common design template? If I understood correctly, he would generalize to something like: If object A refers to object B, but one working on A should never make changes to B, then refer to it by its identifier, and not by B. what would you recommend?
My second question is: Does this have anything to do with DDD? I mean the fact that the Appointment should not be the cumulative root of the doctor, does not mean that it cannot contain references to objects, or am I missing something?
domain-driven-design
tyrone copex
source share