Archive for August, 2012

MVC framework in php

Friday, August 3rd, 2012

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.

MVC framework

MVC framework

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

Debugging techniques required for PHP Web Application.

Friday, August 3rd, 2012

Friends, to be a good developer you need to be well in debugging your code. Writing code is the most easiest task  for a developer, challenge start from debugging. So there are many way of debugging your php web applications. Before you start your debugging you need to chose appropriate tools. The IDE which help me lots for debugging my php application is Nusphear by configuring php debugger on it.

Please check these links

http://www.nusphere.com/products/php_debugger.htm

for more details.

It help you to debug line by line. If your application have some syntax error or fatal error you can find out that place easily as the browser itself show you the place, but what will you do when its giving logical error or show erroneous data. By conventional process echoing variable value in different line is a tedious job which give lots of complexity as per the size of the project. But using debugger you will save lots of time in debugging. In same way if  you facing some JavaScript error  there is a very good debugging technique by using google chrome, please see this link

If you have extensive experience to javascript debugging you can debug in firefox even but firefox doesn’t have any debugger addons for javascript as like Google chrome. So try to adapt new technique of debugging, it definitely double your productivity.

php debugging

php debugging

-Amar