[Cuis-dev] Code design, circular reference

Gerald Klix cuis.01 at klix.ch
Wed Jun 21 01:36:39 PDT 2023


May one ask some questions about the requirements?

A Dynabook may be linked to more than one school (or university)?
Is it possible that one course can belong to more than one school?

Is there a datamodel/ER-Diagram/UML-Object/Class-Diagram?


On 6/21/23 10: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.
What will this editor be editing?
The Dynabook's course hours, the school's course hours, ...?
> 
> 
> 
> 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
IHMO. this makes sense: I can remember cases of German gymnasiums were a
course was held at one school, but was on the curriculum of more than
one gymnasium. Pupils from two gymnasiums attended the course.
Same story for German university lectures. Therefore there should
be a schools (plural) attribute.

> 
> - 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.
There should be more than school. It is possible to study at
more than one university at the same time.
I studied Computer Science at TUM (Technische Universität München) and 
Theoretical Linguistics at LMU (Ludwig-Maximilians-Universität München).
> 
> - 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?
If in doubt design and implement a simulation of the reality.
Of course this will become complicated with lots of circular references.

(I can provide anecdotal reference about how complicate this can become)

> 
> 
> Thanks
> 
> 
> Hilaire
> 
> 

You are welcome!


Best Reagrds,

Gerald


More information about the Cuis-dev mailing list