Relate disciplines and students of a pre-registration system

Asked

Viewed 38 times

0

I’m doing a pre-registration system, and I came across a problem that bothers me a little bit: Diagrama de classes

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 need to know which Estudantes are registered in it.

I’ve thought about Estudante have a list of Disciplina or Disciplina have a list of Estudante, and also the two. The big problem is that the ways that I managed to think were a little coupled.

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

  • 1

    I believe that relationship N to N between student and discipline would solve your case

1 answer

2

Could be created a class called Turma, formed by an attribute Disciplina and a list of Estudantes. The Curso would have a list of Turmas.

To know in which Disciplinas the Estudante is registered, would use a method in Curso who accesses the list of Turmas and for each Turma would access the method that checks whether the Estudante is present in it.

The same logic could be used to Disciplina know which ones Estudantes are registered.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.