Why should I adopt MVC?
Posted
by
Andrew
on Programmers
See other posts from Programmers
or by Andrew
Published on 2013-06-26T07:47:36Z
Indexed on
2013/06/26
10:28 UTC
Read the original article
Hit count: 294
I decided to get my hands wet and got the YII framework for PHP.
I created my first application, then created new controller, model and view. Connected to database, got my record passed from controller to the view and printed the hello world
.
I am confused now. If I have to do the same thing for each page, this seems like a nightmare to me. In each controller I have to do a lot of same operations - declare variables, and pass them to views. I also need to create models for each page and this is all confusing to me. In my idea the main goal of development is to avoid duplication, but what I see here is lots and lots of duplicated code.
Please advise and clarify. Maybe you could suggest a good reading about MVC and coding patterns and best practices in MVC. Because so far, it takes much more time to create a small site using MVC than using my own programming schema.
© Programmers or respective owner