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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap

Dev Shed Tutorial Topics: