capint
6/19/2016 - 5:10 PM

Patterns >> MVC

Patterns >> MVC

Model contains the data and behaviour of the application
View is responsible for displaying it to the user
Controller deals with user input (do validations on inputs)
View: "Hey, controller, the user just told me he wants item 4 deleted."
Controller: "Hmm, having checked his credentials, he is allowed to do that... Hey, model, I want you to get item 4 and do whatever you do to delete it."
Model: "Item 4... got it. It's deleted. Back to you, Controller."
Controller: "Here, I'll collect the new set of data. Back to you, view."
View: "Cool, I'll show the new set to the user now."