Why should I adopt MVC?
- by Andrew
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.