Relate disciplines and students to a pre-registration system

0

I'm doing a pre-registration system, and I came across a problem that bothers me a bit:

As you can see in the picture, Curso has Disciplinas and Estudantes , only that each student needs to know in which Disciplinas he is enrolled, and each Disciplina needs to know which Estudantes are enrolled in it.

I've already thought of Estudante having a list of Disciplina or Disciplina having a list of Estudante , and also the two. The big problem is that the ways I managed to think were a bit coupled.

Could anyone give a suggestion of what I can do, or a Design Pattern that solves this?

    
asked by anonymous 26.07.2018 / 14:27

1 answer

2

A class called Turma could be created, consisting of a Disciplina attribute and a Estudantes list. The Curso would have a list of Turmas .

To find out what Disciplinas Estudante is enrolled, it would use a method in Curso that accesses the list of Turmas and for each Turma it would access the method that verifies that Estudante is present in it.

The same logic could be used for Disciplina to know which Estudantes are enrolled.

    
26.07.2018 / 14:39