Home arrow PHP arrow Centralizing the Validation of Data with the Observer Pattern in PHP

Centralizing the Validation of Data with the Observer Pattern in PHP

Are you looking for an easygoing article that teaches you how to implement the Observer design pattern inside your PHP 5 applications? Your search is finished! Welcome to the last part of the series "The Observer Pattern in PHP." Made up of three articles, this series will show you how to create and work with observer objects, without making you scratch your head while looking at complex code samples.

  1. Centralizing the Validation of Data with the Observer Pattern in PHP
  2. Going backward: listing the full source code for the form validation classes
  3. Notifying the application's core level of validation errors: defining a form observer class
  4. Validating forms: putting the form observer class to work
By: Alejandro Gervasio
Rating: starstarstarstarstar / 8
July 31, 2006

print this article




For those of you who didn't (yet) read the previous installment of this series, let me explain quickly the topics it covered. To begin with, I gave an accessible explanation of what the Observer pattern is about, and accompanied all the corresponding theory with a straightforward practical example, to help you easily understand how to apply this popular design pattern in your own PHP 5 applications. I'm don't mean to say that you're going to grasp the logic of observer objects in no time, but I firmly believe that a simple example will help you out by pointing you in the right direction.

Provided that you already know what an observer object is, you'll realize that this pattern is indeed helpful for decoupling disparate objects from the rest of the application. Besides, the pattern will assist you in the development of programming mechanisms aimed at reflecting specific changes produced by several components at the application's core level. This is a highly desired feature, particularly if you're building PHP programs that require the implementation of truly independent objects.

Right, I hope the concepts that I touched on above are fresh in your mind now, because it's time to continue exploring the advantages of using the Observer pattern in PHP 5. Now, surely you're wondering: how does this story continue? Well, over the course of this last tutorial, I'll be moving the application of observer objects toward the real world, in this case by showing you how to include these objects within a set of form-validation classes. After reading this article, you should be equipped with a decent knowledge of how a form checking application can use the powerful features of this widely-known design pattern.

Having established the goals for this last installment of the series, it's time to continue learning about observer objects. Let's do it together!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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: