PHP Project Development

fishhookFladgeInternet and Web Development

Dec 13, 2013 (3 years and 7 months ago)

64 views



PHP Project
Development


PHP Project Development

Model-View-Controller pattern (MVC)

DotKernel (DK)

Zend Framework (ZF)

MVC in DotKernel

Project Development


Model-View-Controller concept

Model – data layer

View – user interface
(UI), presentation
layer

Controller – business
logic layer


Model-View-Controller concept


Model (Data Layer)

Process data

Actual content that is stored in database or files

Encapsulates core application, data and
functionality “Domain Logic” (the calculations and
data storage that form the core of the application)

Must be
independent

It cannot refer to either the view or controller
portions of the applications

May not hold direct instance variables that refer
to the view or the controller


View (user interface)

System output

A base presentation class that will handle
loading and displaying the applications
after they have run (display application in
different format - HTML,...)

Obtain data from the model and presents it
to the user

Should not change the state of the model


Controller

System input

Accepts and intercepts user requests and
controls the business objects to fulfill these
requests

Coordinates the operations of the MV layers by
taking user input, manipulating the Model, and
causing the View to react appropriately

Responsible for calling methods on the Model
that change the state of the Model

Is
not
a
mediator
between the View and the
Model


MVC boundaries

Do not cross the boundaries.

View should not control or store data.

Similarly, controller and model...


Is this in my boundary ?”


Framework

Project skeleton

Interface between the three layers (MVC)

Ensure that we will adhere to the design
patterns principles

Does not let us „so easy” to cross the
boundaries

Handle complexity on our behalf


What is DotKernel

DotKernel is the framework from which to
start a new application, based on Zend
Framework.

DK is using a simplified MVC

DotKernel can be seen also as a „skeleton”
that use many features from Zend
Framework


Why Zend Framework

Simple to use

Facilitates applications performance

Ensure security

Separate HTML from PHP

Encourage code quality

Enforce best practices

Availability of compressive documentation

Active community around the framework


Zend Framework Features

We recommend to search first into the ZF
classes when you need a new feature to be
added to your project, e.g:

Zend_Cache,

Zend_Feed,

Zend_Service(Amazon, Twitter,
Yahoo,...),

Zend_Soap,

Zend_Translate,...
http://framework.zend.com/manual/en


MVC in DotKernel


MVC in DotKernel

Bootstrap (index.php)

Handles all requests, deciding what
happens next

Front Controller (indexController.php)

Only one per module

Routes requests to AC

Action Controller (pageController.php)

the heart of MVC Controller

Multiple AC inside one module


Beyond framework

The framework does not finish your project.

Framework will simplify the project, but we
need to KISS

KISS – Keep It Short and Simple

KISS – Keep It Simple, Stupid


Project Development
Continuous improvement

Where are we ?

Where are we going ?

Where do we want to go ?
People are the single most valuable
resource in any software project

Do not work hard, but smart


External image:

http://www.nerds-central.com/Images/MVC_Overlay600.jpg