MVC and DAO standard

Asked

Viewed 539 times

3

I have a layered system.

I’m using MVC and inside the MODEL folder I have a DAO folder. Let’s assume I have a file called Professor_dao and another one called Aluno_dao.

Question: Can I include the Student in Teacher file to call some method present in this? This would break the pattern?

  • Take a look at ASP Net Razor Pages, which simplifies MVC

  • Which programming language?

  • @Victorstafusa PHP

1 answer

4


Can I include the Student-to-Teacher file to call some method present in this? This would break the pattern?

Yes, this does not break the MVC standard. The MVC standard only tells how the model, vision 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 in that.

As for the DAO, if you are not breaking the rule that the Aluno_DAO contains methods of persistence of Aluno and that Professor_DAO contains the persistence methods of Professor, all right. It is allowed that Aluno_DAO may need to know something about Professor or that Professor_DAO may need to know something about Aluno, provided that one does not end up worrying about the persistence of what should be the other.

  • Thank you for the Reply!!!

Browser other questions tagged

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