I need to know where in the MVC should I apply the business rule.
Imagine the situation: I have a school and I need to generate a calendar of classes for teachers. Each teacher has a school subject and is only available certain times. I need to generate this calendar in such a way that teachers can performing without timing conflicts.
Here are my questions:
- What part of MVC the teacher should be part of? Taking into mind that your timings data are stored externally (such as a SQL database or an XML), it should be a Model, correct?
- Now, where in the MVC the business rule that will compile the calendar should be developed? Like Controller or a Library?
- These data could be worked directly into the Model, or perhaps a specific Model to work with other Models?
Now a bit of my vision: (please, correct me if I'm wrong)
- The data from the teachers should be handled by a Model. So that I could, for example, get the timing available to him and his school subject. So, Teacher is Model.
- The compilation of the calendar could be done in a controller or library. Question: but, controllers should be related to routes, and libraries to an API?