As like human civilization improves day by day, as like technology upgrading day by day our very own open source web technology PHP is also civilizing day by day. And MVC framework bring a new revolution in php programming language. In our conventional php application, we have mixed all the layer of application together. These layer are Model, View, Controller. Model represent the database and its table, so anything which required database interaction is taken care by model. View represent the presentation or more popular word UI for your web application, which mainly deal html and design related things and last Controller represent the logical part of your whole application. Starting from the request handling to response output back to client is taken care by controller.
So what is the advantage of MVC on primitive php coding style ?
Answer is its make your life easier, and your coding much more easier. As we all know that our industry follow the agile development pattern. So, very frequently you need to change your tables, design as well as logic too. Just think if these are very separated from each other , it means if you want to change the UI you don’t have to bother for or without disturbing other thing (controller & model) you can do it neatly and easily. Same thing happen for controller and model. Far more it not only increase the flexibility of code it also give robust structure to your code. Apart from those utility its also increase the most important thing in web world i.e. security . By help of MVC framework we can just secure our table by pushing our model behind a firewall. It combat with the sql injection from front end because it has inbuilt data sanitization. Even bad request or force request can be handle by our controller efficiently. Its give you various choice of security for your web.
So, my friend why you are still following the old coding style switch to MVC style and make yourself more stylish. There are number of good MVC framework in php such as CakePHP, Zend, YII, Codeigniter etc. These are really interesting and easy to adapt framework.
– Amar
Tags: MVC architecture, PHP







