MVC WITH CODEIGNITER Presented By Bhanu Priya. MVC stands for "Model View Controller”. ...

Post on 19-Jan-2016

218 views 0 download

transcript

MVC WITH CODEIGNITER

Presented By Bhanu Priya

MVC

MVC stands for "Model View Controller”.

Model-View-Controller is a software architecture, or design pattern, that is used in software engineering for developing web application.

MVC is a concept that enables us to separate our business logic from the presentation.

Model View Controller Architecture

Model View Controller contains three parts.

Model View Controller

PARTS OF MVC

The model is a lowest level of the pattern.

Model manages all the behaviour of the data of the application.

It responds to the requests from view.

It also responds to instruction from the controller to update itself

MODEL

View is used for displaying all or portion of data to the user.

View can present the data in a particular format which is triggered by controller’s decision.

Script based templating system like Jsp , Asp , PHP, Ajax(Easy to integrate).

VIEW

The controller is responsible for responding to user input and perform interactions on the data model objects.

The controller receives the input and validates the input, then performs the business operation that modifies the state of the data model.

Controller acts as interaction between model and view.

CONTROLLER

Controller receives all the requests from the user for the application with an isolation.

It works with the model to prepare any data needed by the view.

It also represents to instruction from the controller to update itself.

PROCESS

The user interacts with the View which presents a web form.

The user submits the form, and the Controller receives the POST request. It passes this data to the Model.

The Model updates and queries the database and sends the result back to the Controller.

The Controller passes the Model’s response to the View.

The View updates itself with the new data and is displayed to the user.

ARCHITECTURE

Reduce the code complexity.

Reusability.

Extendability.

Time Consuming.

WHY USE MVC

There’s increased complexity as an application may use other patterns at the same time as MVC.

The view and the controller are closely coupled which makes modification to one affect the other.

When the model is active frequent changes to model can result in excessive updates of the corresponding views.

PROBLEMS OF MVC

Reusability.

Clarity of design.

Efficient modularity.

Multiple views.

Ease of growth.

Distributable.

ADVANTAGES OF MVC

It is too complex to implement.

It is not suitable for smaller application.

There is a chance to occur code duplication.

Increased complexity.

Close coupling between view and controller.

DISADVANTAGES OF MVC

Substitutable user interface.

User interface components.

Multiple simultaneous views of the same model.

Synchronized views.

Easier user interface changes.

Easier testing.

BENEFITS OF MVC

Codeigniter is an Application Development Framework - a toolkit - for people who build web sites using PHP.

Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch.

Rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries.

It is focused by minimum amount of code.

CODEIGNITER

IT is primarily focus on,

Model-View-Controller basics. Routing basics. Form validation. Performing basic database queries using "Active Record“.

CODEIGNITER(CONTIN)

<?php

Class ABC extends XY_Controller {          Public function index ()          {                  Echo ‘Hello World!’;          }          public functionwishes()          {       echo ‘Good Morning!’;          } } ?>

For example

Easy to learn, adopt and deploy.

Easy handling and customizing.

We can add new functionality without affecting the customization at all.

Offers flexibility and easy management With MVC based framework.

Active Record Implementation is simply superb and easy to remember.

ADVANTAGES OF CODEIGNITER

Provides easier configuration and customization of configuration files.

Good collection of possessed libraries.

Awesome documentation of the user guide, which makes it easy for any coder to use the whole framework.

Enables to incorporate its own existing scripts as well as develop core libraries for the system.

Its PHP based only and not very object-oriented in some parts.

PHP legacy code.

Irregular releases.

DISADVANTAGES OF CODEIGNITER

A small track and astounding presentation.

Configuration and normal coding rules are not required.

Depiction of straightforward solutions.

Free from complex structures and development.

BENEFITS OF CODEIGNITER

http://www.tutorialspoint.com/struts_2/basic_mvc_architecture.htm

http://salopek.eu/content/28/create-a-simple-php-mvc-framework

http://ellislab.com/codeigniter http://ellislab.com/codeigniter/user-guide/ http://phpdog.blogspot.in/2012/02/codeigniter-tutorials-for-

beginners.html http://tutsforweb.blogspot.in/2012/05/user-registration-with-

codeigniter.html

REFERENCE

THANK YOU