dimanche 23 octobre 2016

MVC: How to seperate Model from Controller

Theoretically, I understand the MVC design pattern, but in real life I'm not sure about the Model and Controller.
Basically my question is: What sort of code should each of them contain?

From what I understand it might be something like this:

  • Model: Starts a connection with the DB, contains abstractions (objects) that represent the data, ORM, plus some kind of an interface (functions) for the controller to get or change stuff in the DB.
  • Controller: The main program. Starts the web server, starts an instance of the model's DB handler, does all the logic with the models objects.

Am I missing something?




Aucun commentaire:

Enregistrer un commentaire