Can I include the student file in teacher to call any method present in this? Would that break the pattern?
Yes you can, this does not break the MVC standard. The MVC standard tells you just how the model, view, and controller layers should communicate. However, Aluno
and Professor
are objects that are both within the model layer, and therefore the MVC pattern is not broken by an interaction between them. In fact, it is quite common for several classes within the model layer to interact with each other and there is no problem at all.
Regarding DAO, if you are not breaking the rule that Aluno_DAO
contains persistence methods of Aluno
and that Professor_DAO
contains persistence methods of Professor
, that's fine. It is allowed that Aluno_DAO
may need to know something of Professor
or that Professor_DAO
may need to know something of Aluno
, since one does not end up worrying about the persistence of what should be on the other.