Home arrow PHP arrow Using Abstract Factory Classes in PHP 5 to Work with Online Forms

Using Abstract Factory Classes in PHP 5 to Work with Online Forms

Any PHP developer who has worked with pattern-based programming in PHP for a while knows that the abstract factory pattern is useful for building classes that return (to client code) objects whose type depend on the content where they're used. Welcome to the final installment of the series "Using abstract factory classes in PHP 5." If you're interested in learning the key concepts of this helpful pattern, this three-part series will teach you how to apply it by developing numerous educational examples.

  1. Using Abstract Factory Classes in PHP 5 to Work with Online Forms
  2. Defining an abstract form element factory class
  3. Creating context-driven form objects
  4. Understanding how the abstract factory pattern works
By: Alejandro Gervasio
Rating: starstarstarstarstar / 9
February 07, 2007

print this article



Surely, you'll remember that in the course of the previous article, I demonstrated how to implement the logic that drives the abstract factory pattern to create diverse types of AJAX objects (commonly known as XML HTTP request objects), by defining two concrete factories.

Naturally, in accordance with the programmatic model established by the pattern in question, this pair of concrete factories would make sure that the correct type of HTTP requester objects would be returned to client code, depending on the context where they'd be used. More specifically speaking, the scenario that I just described demonstrates the remarkable functionality offered by the pattern when it comes to spawning objects that only work correctly in predefined environments.

So far, I think that all the practical examples that you learned during the two previous articles of the series should give you a more accurate idea not only of how this pattern works, but also how it can be applied in different situations that may be familiar to you.

However, I wouldn't like to stop here, since the pattern's capacity and functionality really deserve another close look. Therefore, in this last installment of the series, I'm going to show you how to use an abstract factory class to create distinct types of form objects, logically depending on the context where they will be utilized.

The idea not only sounds interesting, but it can provide you with a better understanding of how this handy pattern can be used in a real situation.

Having established the objectives for this final part of the series, let's discover together how to use the abstract factory pattern in PHP 5 to generate web form elements. Let's get started now!

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