Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC pattern: what needs to be created first?

I'm studying CodeIgniter and its software patterns. Which should be created first, the view or the controller?

like image 319
Mazzy Avatar asked Feb 12 '12 15:02

Mazzy


2 Answers

The Model because that is your application. Controller and View only form one interface to the Model. One could say, the controller is the door to your house. What do you build first? The door or the house? Right, so build the Model first. Then add an interface to it.

like image 102
Gordon Avatar answered Sep 25 '22 05:09

Gordon


I know this might be old question ,but I bumped into it now.
And someone else might need it later. So I decided to summarise it.
I think that your approach will depend on situation.
Let the order of operations you make be this Model-View-Controller
And lets call it Bottom-To-Top approach. The case and reasoning for this is provided by @Gordon here .
And another case lets call it Top-To-Bottom, when you start with UI. The case and reasoning for this is provided by @shiplu.mokadd.im here.
Evaluate your own case and choose one of them. Good luck!

like image 26
Baimyrza Shamyr Avatar answered Sep 25 '22 05:09

Baimyrza Shamyr