PHP
  Home arrow PHP arrow Introducing the Facade Pattern in PHP ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Introducing the Facade Pattern in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 6
    2007-01-16

    Table of Contents:
  • Introducing the Facade Pattern in PHP 5
  • A basic implementation of the facade pattern
  • Using HTTP compression with PHP 5
  • Completing the facade schema
  • Seeing the facade pattern in action

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introducing the Facade Pattern in PHP 5


    (Page 1 of 5 )

    The facade pattern may be one of the less well known patterns in PHP, but it definitely has its uses. In this first article of a two-part series, you'll learn the basics of how the facade pattern works, illustrated with numerous examples.

    As you’ll certainly agree, pattern-based PHP programming is sometimes a hard-to-master topic. It logically has to be addressed with a considerable level of knowledge (and experience, to be frank), more specifically in those cases where the design pattern to be implemented presents a high grade of abstraction.

    Of course, this doesn’t mean that all of the PHP applications that you’re going to develop from this point onward must solve programming-related problems by utilizing a particular pattern. However, learning how to apply different design patterns to tackle common and well-known issues may help to expand your existing background as PHP developer, in addition to improving your overall experience.

    Assuming that the previous paragraphs already convinced you that learning pattern-based programming with PHP might be an instructive and educational experience, in this series, which is comprised of two comprehensive articles, I’m going to introduce the foundations of an interesting structural pattern. I’m talking specifically of the facade pattern.

    Since I have to admit that this one isn’t very commonly used amid the huge terrain of PHP-based web development, let me first walk you through a brief introduction about what it does. In this way you can anticipate what you’ll learn in the course of these two articles.

    To put it simply, the facade pattern can be applied in those situations where you need to create a PHP class which requires the implementation of a complex system as part of one of its methods. At first glance, the previous definition sounds like something applicable in many cases, but the advantage of using a facade schema relies on the point that the class can hide all the logic of the mentioned mechanism, while the mechanism in question knows nothing about the calling class. That sounds pretty good, right?

    To clarify the above concepts a bit more, allow me to cite an illustrative example: suppose you have a class which uses a complex set of additional classes to serialize/unserialize different objects before saving them to a database table. In this case, you have a class that hides all the complexity required for serializing the mentioned objects, but there’s also a group of classes that know nothing about the class that called them. As you can see, these classes are only responsible for performing the serialization/unserialization sequence on several objects and nothing else. Period.

    Now, are you’re starting to grasp the logic behind the facade pattern? Of course you are!

    At this moment , and after explaining a few basic points on how to use the facade pattern with PHP, let’s move forward and learn how all these theoretical concepts can be translated into some functional hands-on examples. Are you ready? Good, let’s get started!

    More PHP Articles
    More By Alejandro Gervasio


       · In this first part of the series, the foundations of the facade pattern are...
     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway