About Me

My photo
Hi…My Self Hardik Patel. The meaning of my name is “From the Bottom of the Heart” , “Hearty boy”. I am working as Sr. Web Application Developer at IndiaNic Infotech Ltd. in Ahmedabad, Gujarat, India. I have total 2.5 Years of Experience as PHP-Open source Professional. Well , I have done Master of Computer Application & Information Technology (M.sc [ IT ]) from K.S.School of Business management at Gujarat University in 2009. I have always believed in simple living and high thinking. I am a confident, commited and ambitious person. I am also a creative and hard working person but at times somewhat lazy too. But when I determine something I do it till it gets finished. I am very funny in nature and mixed with everyone very fast. Well I am very talkative person but people likes my company …….I love every food which is Tasty. I like travelling , like to play Chess and Cricket and surf on the net. And if you know more about me than defiantly you have to meet me earlier. Thanks

Thursday, March 24, 2011

MVC basics

For starters, MVC stands for Model, View, Controller. It is a programing pattern used in developing
web apps. This pattern isolates the user interface and backend (i.e. database interaction from each other. A successful
implementation of this lets developers modify their user interface or backend with out affecting
the other. MVC also increases the flexibly of an app by being able to resuse models or views over
again). Below is a description of MVC.

* Model: The model deals with the raw data and database interaction and will contain functions
like adding records to a database or selecting specific database records. In CI the model
component is not required and can be included in the controller.
* View: The view deals with displaying the data and interface controls to the user with.
In CI the view could be a web page, rss feed, ajax data or any other “page”.
* Controller: The controller acts as the in between of view and model and, as the name suggests,
it controls what is sent to the view from the model. In CI, the controller is also the place to load libraries and helpers.

An example of a MVC approach would be for a contact form.

1. The user interacts with the view by filling in a form and submitting it.
2. The controller receives the POST data from the form, the controller sends this data to the model
which updates in the database.
3. The model then sends the result of the database to the controller.
4. This result is updated in the view and displayed to the user.

This may sound like alot of work to do. But, trust me; when you’re working with a large application, being able to reuse models or views saves a great deal of time.