Timeline for Where should I put an API request in MVC?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 23, 2020 at 12:59 | comment | added | Mateus Felipe | @CLW Wikipedia clearly states that Model "directly manages the data, logic and rules of the application", and Controller "accepts input and converts it to commands for the model or view". Thus, the logic and business rules SHOULD be in Model. The Controller is only a interface between View and Model. | |
| Aug 11, 2015 at 11:56 | comment | added | CLW | @anaximander No I'm referring to the Model in a fairly strict interpretation of of MVC (see Wikipedia, Microsoft MVC, Head First Design patterns, etc...) In those instances the Model is nothing more than a simple struct for passing data around and there is no such thing as a viewmodel. While the Microsoft MVC implementation does add various attributes to the model, this is more for convenience than anything. In the end the purpose of the MVC pattern was to facilitate good practice of code separation and limit side effects. | |
| Aug 11, 2015 at 9:54 | comment | added | anaximander | I think when you say "model" here, you're referring to "viewmodel", which IMO is a separate thing. A viewmodel gets data from the controller to the view, and as such is either an implementation detail of the View, or an aspect of the communications between View and Controller that doesn't really fit into either (depends how you see it). The "Model" in MVC refers to a system model - a representation of the system that incorporates its data, structure and behaviour. The Model is state and logic; the Controller is what causes the logic to run and the state to change when the View is manipulated. | |
| Aug 10, 2015 at 14:54 | review | First posts | |||
| Aug 11, 2015 at 5:49 | |||||
| Aug 10, 2015 at 14:51 | history | answered | CLW | CC BY-SA 3.0 |