mardi 24 janvier 2017

MVC, difference between controller and model?

I was watching some Swift instructional videos from Stanford on youtube. The instructor (Paul Hagerty, great teacher!) speaks about how iOS is built around the idea of MVC (model-view-controller). I've read some people say on stack overflow that the idea is dead, and others say that a lot of web developers use this terminology now.

I'm having trouble differentiating between controller and model. I've read MVC described as user interface (web page/UI), controller (server), and model (database). But the instructor described it as view (UI, which is easy to understand), model (data and logic that does a calculation for example), and controller (which connects model and view with your specific programming logic).

What I don't understand is if there is no database in the case of a standalone application (not web), aren't we also creating the data and logic of how our program works at the same time? What is the difference between controller and model in this situation?




Aucun commentaire:

Enregistrer un commentaire