cake php oops approach for php

23
Cake PHP – OOPS approach for PHP www.otssolutions.com

Upload: deepika-chaudhary

Post on 12-Jun-2015

2.015 views

Category:

Technology


3 download

DESCRIPTION

OTS Solutions delivering high quality open source solutions like Cakephp Application Development, Cakephp Web Development services by expert professional developers.

TRANSCRIPT

Page 1: Cake php  oops approach for php

Cake PHP – OOPS approach for PHP

www.otssolutions.com

Page 2: Cake php  oops approach for php

What is CakePHP ?

• CakePHP is written in PHP and is modeled after the concepts of Ruby on Rails (ROR)

• CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications.

• CakePHP makes use of commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.

Page 3: Cake php  oops approach for php

Why use CakePHP ?

• Model, View, Controller Architecture• Helps developers to reduce code

repentance in creation of websites or web applications.

• Application Scaffolding.• Built in view helpers for AJAX,

JavaScript, HTML Forms. • Access Control Lists

Page 4: Cake php  oops approach for php

Why use CakePHP ?

• Data Sanitization• Security, Session, and Request

Handling Components • Flexible View Caching• Full support for PHP OOP’s approach

And • It is developed under the MIT license

so it is free for everyone

Page 5: Cake php  oops approach for php

Where to use CakePHP ?

• Highly scalable projects• Projects with Heavy Database

Interactions and Object Relational Mapping

• Projects where caching is needed• Projects which needs to be

implemented with MVC approach• Where code re-usability is necessity

Page 6: Cake php  oops approach for php

Where not to use CakePHP ?

• Basic Blog • Basic CMS • Basic E-Commere • Basic Forums / Bulletin Boards

Page 7: Cake php  oops approach for php

Who is using CakePHP ?

Page 8: Cake php  oops approach for php

What is MVC approach?

Page 9: Cake php  oops approach for php

What is MVC approach?

• Model/View/Controller (MVC) is a software architecture used for building applications.

• MVC separates the business logic and application data from the presentation data to the user.

• Applications built using MVC approach are re-usable and expressive.

Page 10: Cake php  oops approach for php

What is OOPs?• Object-oriented programming is a method

of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships.

Page 11: Cake php  oops approach for php

OOPs advantages over conventional approaches

• OOP provides a clear modular structure for programs which makes it good for defining abstract data types where implementation details are hidden and the unit has a clearly defined interface..

• OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.

Page 12: Cake php  oops approach for php

OOPs advantages over conventional approaches

• OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.

Page 13: Cake php  oops approach for php

Characteristics of OOPs• Class definitions • Objects• Abstraction• Encapsulation • Inheritance• Generic classes• Polymorphism

• Operator and Function overloading. • Message Passing

Page 14: Cake php  oops approach for php

How OOPs work

• Classes describe objects• Objects inherit from superclasses

Page 15: Cake php  oops approach for php

Class Hierarchies

Page 16: Cake php  oops approach for php

Advantages of OOPs

• Simplicity• Modularity• Modifiability• Extensibility• Maintainability• Re-usability

Page 17: Cake php  oops approach for php

OOPs in PHP

• PHP 5 has a full object model as compared to PHP4.

• PHP treats objects in the same way as references or handles, meaning that each variable contains an object reference rather than a copy of the entire object.

• PHP supports Visibility, abstract and final classes and methods , additional magic methods, interfaces, cloning and typehinting

Page 18: Cake php  oops approach for php

OOPs Features in PHPAutoloading : Autoloading is a mechanism where you can specify where the code should look for a class name that follows a particular pattern. Once you have set this up, usually very early in the script when everything gets configured, then you can simply instantiate classes without having to expressly include their declaration files.

Page 19: Cake php  oops approach for php

OOPs Features in PHPInterfaces : PHP does not have multiple inheritance, so each object can only have one parent, and the top-level parent of all objects is of type StdClass. However PHP does support interfaces, which allows polymorphism (one class which can look like another) in PHP.

Page 20: Cake php  oops approach for php

OOPs Features in PHPType Hinting : We use the instanceOf comparison operator to check that an object with the correct capabilities had been received, but we can make this simpler by using type hinting in our functions and object methods. .

Page 21: Cake php  oops approach for php

OOPs Features in PHPFluent Interfaces : This is a neat trick that can often be seen in particular in framework code, so it is worth a mention here. A “fluent interface” is one where you can chain the methods together, useful especially where you would be calling a sequence of methods on the same object.

Page 22: Cake php  oops approach for php

Thank You

http://www.otssolutions.com/

Page 23: Cake php  oops approach for php

http://www.otssolutions.com/

India Gurgaon ( Haryana ) 795, Udyog Vihar, Phase-V Gurgaon(Haryana) India Ph: +91 124 4101350 +91 124 4748100

Write to us at: [email protected]

United kingdom88 Wood Street 10th Floor London EC2V 7RSPh: +44 208 099 1660

Write to us at: [email protected]

USA 4433 Merlin Way , Soquel CA 95073United StatesPh: +1 408 540 0001 Write to us at: [email protected]