PHP
  Home arrow PHP arrow The Singleton and Factory Patterns in PHP: designing an object factory
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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

The Singleton and Factory Patterns in PHP: designing an object factory
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2005-11-09


    Table of Contents:
  • The Singleton and Factory Patterns in PHP: designing an object factory
  • The first step within the development process: coding form element classes
  • Finishing the round: listing the rest of form element classes
  • The Factory Pattern in action: developing the "formElementFactory" class
  • Instantiating form element objects: a simple use of the form element factory

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    The Singleton and Factory Patterns in PHP: designing an object factory
    ( Page 1 of 5 )

    This article, the second part of a series, is focused on implementing the Factor Pattern by designing a form element factory.

    Introduction

    This is the second part of the series "The Singleton and Factory Design Patterns in the real world." Welcome back. Throughout the first part of the series, I provided you with an overview of building object-oriented forms using two popular design patterns: the Singleton and the Factory patterns.

    At this point, I assume that these aren't foreign concepts to you, since they were reviewed in the first part. Just in case  you don't feel very seasoned with patterns, you should start by reading my previous article, where I offered a friendly introduction to them.

    If you're used to writing a lot of repetitive code to build your web forms, probably you've found the technique that I previously explained to create forms, based on an object-oriented approach, quite interesting. Due to the advantages inherent in this method, form generation can be translated into a flexible and straightforward process that strongly encourages code re-use.

    Focusing again on the objective of this series, this second part is aimed specifically at implementing the Factory Pattern, by designing a form element factory, which will be tasked with building regular form components, in this way abstracting the rendering process for each element.

    Essentially, the article is intended to provide a practical step-by-step guide to apply design patterns in real world conditions, such as form design an implementation, by attending the requirements that most developers must face on a frequent basis.

    Thus, it's time to go deeper into the object-oriented form generation method. Let's go!



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

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT