Home arrow PHP arrow Object Interaction and Mediator Classes in PHP 5

Object Interaction and Mediator Classes in PHP 5

Are you looking for an approachable guide on how to use the mediator design pattern in PHP 5? If you answered "yes," then you should take a look at this group of articles. Welcome to the final part of the series that began with “Introducing Mediator Classes in PHP 5.” This series takes you through building mediator classes with PHP, and shows you how to use this useful pattern with copious code samples.

TABLE OF CONTENTS:
  1. Object Interaction and Mediator Classes in PHP 5
  2. Expanding the initial mediator class
  3. Building some additional file handling classes
  4. Implementing the mediator pattern
By: Alejandro Gervasio
Rating: starstarstarstarstar / 5
March 20, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

If you already went through the first tutorial of the series, then quite possibly the mediator pattern will be quite familiar to you. However, if it doesn't ring any bells, let me offer you a quick introduction to how it works. This will let you can grasp more easily the purpose of the hands-on examples that I plan to include in this final article of the series.

Essentially, when the mediator pattern is implemented in the context of a given PHP application, there's a class (the mediator) which behaves as a centralized mechanism that maintains a complete synchronization between two or more additional classes. These classes are structured in such a way that all the tasks that they perform are handled via the respective mediator.

Logically, the rather confusing character of the previous definition implies that the topic must be complemented with a decent number of practical examples. These will hopefully serve to help you understand the logic that drives the mediator pattern more easily.

Therefore, keeping in mind the strong educational sense that the subject really deserves, in the first article of the series I built a mediator class which was provided with the ability to keep a couple of data file handling classes entirely synchronized. This meant that when one class changed the case of the data it handled, the other one also reflected this modification via the mediator. Quite good, right?

Okay, at this stage I believe that implementing the mediator pattern with PHP 5 should be a pretty painless process to you, but if the examples that I showed you in the first article weren't enough to help you completely grasp this pattern, over the course of this last tutorial I'm going to expand the original mediator class that you learned previously. The expansion will make it capable of maintaining three classes in perfect synchronization.

Well, with the preliminaries out of our way, let's learn more examples of how to apply the mediator pattern with PHP 5. Let's go!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: