Business logic, what is it?
The MVC template describes a simple way to structure the annex, the purpose of which is to separate Business logistics from User interface♪ As a result, the application is easier to scale, tested, accompanied and certainly implemented.
It is not clear what this term means.
Business logic is the logic of a home model, all that in your annex is in terms of the subject area.
For example, SO is all actions with users, questions, answers, pros, minus, etc.
If the user didn't get a ZZZ reputation - send his right to be tested by other participants - it's a business logic, it's a model.
Redirecting the user to the page of the question after it was established - the logic that belonged in the counteraller.
Lift the button "Lave the Commentary" if the current user has no right to leave comments - the characteristics of the presentation (model flex) - in view.
MVC makes it possible to distinguish "no-business" logic related to the user interface:
- Challenges to the user-specific model
- Preparation of data for sending to the client.
...and place the logic of the presentation in a separate piece of the annex - Controller.
By leaving a clean business logic not tied to the user interface.
It is worth noting that the reference to the issue leads to an article illustrated by the Classic MVC diagram. A more modern version of pattern - MVC Model2 - and its derivatives are actually used in the Web. His difference - View does not interact directly with the model.
Interaction in modern MVC is like: