[Cuis-dev] Code design, circular reference

H. Fernandes hilaire at drgeo.eu
Wed Jun 21 01:05:30 PDT 2023


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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230621/7883871c/attachment.htm>


More information about the Cuis-dev mailing list