[Cuis-dev] Code design, circular reference

Andres Valloud ten at smallinteger.com
Wed Jun 21 01:18:09 PDT 2023


I don't see a CourseSchedule object in the school (which contains the 
assignment of each course to the available time slots).

On 6/21/23 1:05 AM, H. Fernandes via Cuis-dev wrote:
> Hi folks,
> 
> I have a design question with circular reference I want to avoid, and I 
> am investigating options. Here is the situation:
> 
> - a *Dynabook* object (likely a singleton) with a /schools/ attribute
> - each *School* instance has a /timeSlots/ attribute, a collection of 
> *TimeSlot* describes the time division of a school day
> - deep in the objects tree, Dynabook>school>course>/courseHours/ 
> describe the time schedulle of a *Course*
> 
> The /courseHours/ GUI editor needs to refer to the /timeSlots/ 
> collection in the parent *School* instance. I wonder how to do that 
> properly.
> 
> There are possibly several *School* instances (a person may teach in 
> several schools with different time slot).
> 
> I though of several options:
> - to have a /school/ attribute in the *Course* instance, I don't like 
> the idea
> - to have a /schoolContext/ attribute in the *Dynabook* object. The 
> attribute refers to the *School* instance in use. I am afraid it could 
> be out of synch easily.
> - to pass in reference the *School* instance to intermediate GUI 
> methods, a bit tedious
> - to search for the *School* parent instance of a given attribute in the 
> tree by interogating the *Dynabook* instance. Should work well, may be 
> overkill.
> 
> Options? Opinions?
> 
> Thanks
> 
> Hilaire
> 
> 
> Dr. Geo -- http://drgeo.eu
> 
> 


More information about the Cuis-dev mailing list