PHP
  Home arrow PHP arrow Introducing Mediator Classes in PHP 5
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 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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 Mediator Classes in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2007-03-13

    Table of Contents:
  • Introducing Mediator Classes in PHP 5
  • Creating a simple mediator class
  • Building a pair of data file handling classes
  • Building a practical example

  • 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 Mediator Classes in PHP 5


    (Page 1 of 4 )

    The mediator design pattern can help you achieve and maintain synchronization between a group of PHP classes. In this first of a two-part series, you'll be introduced to the mediator pattern, how it functions, and how it can help you with your application development.

    Introduction

    As you'll possibly agree with me, at some point in your productive life as PHP developer, you've had to build web applications comprised of different, highly independent modules, which naturally perform well-differentiated tasks. Besides, it's normal to see that these modules very often establish a carefully planned interaction with each other, by means of a centralized mechanism, to stay in synchronization with the rest of the application.

    Database interfaces and data validation systems, among other applications, are clear examples of using a unique, centralized programming module to keep all the different components that integrate a PHP application synchronized. You should be quite familiar with this concept.

    The previous schema of interaction between the diverse modules of a given application seems to be pretty straightforward to implement during the development period; however, it should be admitted that this model isn't too easy to apply, particularly when it comes to using a set of predefined PHP classes.

    The creation of a specific class, which has to be capable of keeping the interaction of other classes centralized (and synchronized) sounds hard to achieve, at least without using the benefits offered by pattern-based programming. So what's the point in utilizing this approach, after all?

    Well, in this case, the synchronization between a group of PHP classes can be made by implementing a useful pattern widely known as "mediator." In short, when the mediator pattern is applied, there's a single class that implements the logic required to keep all the other classes completely synchronized with each other. This means that not only will all the modifications introduced by one class be reflected in the others, but that those changes will be performed via the interface of the mediator class.

    Of course, it's quite possible that you find the above definition rather hard to grasp, therefore in this two-part series, I'm going to show you how a mediator class can be defined, and logically how it can be put to work as well, by employing numerous instructive examples.

    So, are you ready to learn more about how to implement this handy design pattern with PHP 5? Okay, let's get started now!

    More PHP Articles
    More By Alejandro Gervasio


       · Over this first article of the series, the logic that drives the mediator pattern is...
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT