PHP
  Home arrow PHP arrow The Singleton and Factory Patterns in ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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: Building object-oriented forms
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 27
    2005-11-02

    Table of Contents:
  • The Singleton and Factory Patterns in PHP: Building object-oriented forms
  • When one is better than many: a quick look at the Singleton Pattern
  • Object-oriented forms: applying the Factory pattern to a real application
  • The first approximation to object-based forms: building form element classes

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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: Building object-oriented forms


    (Page 1 of 4 )

    Experienced PHP programmers know that web development problems are often tackled by using widely known design patterns within the context of an application. This article is the first in a series that will demonstrate how the Singleton and Factory patterns can be implemented in a real-world application.

    Introduction

    Many web developers around have started to use extensively object-oriented programming in PHP applications. Due to the fact that this approach requires a radical change in the way that situations are solved within a program, it takes a while to get an intimate grounding in this paradigm.

    Going one step further, for PHP programmers with a certain level of experience, the use of widely known design patterns within the context of an application is definitely a common method for tackling many problems inherent in web development. Since design patterns are key concepts involved in software engineering, mastering them directly implies having a strong knowledge about their theory and practical implementation.

    Of course, through this series, I'm not going to offer a detailed definition of the most used design patterns, since there's all sorts of clever information on the subject in many good books and rich-content articles that thoroughly cover the topic. Instead, the primary goal of this series is to demonstrate how the Singleton and Factory patterns can be implemented in a real-world application, without the need to incur in the use of rather impractical examples.

    If you've read the article's title, surely know what I'm talking about. I'll apply the above mentioned design patterns to building web forms, by utilizing an object-oriented approximation. Hopefully, the overall experience will be useful enough to teach how (X)HTML forms can be created by relying strongly on these two familiar patterns.

    However, if you're just starting to learn about the topic, don't feel concerned. I'll cover briefly the corresponding definition for the Singleton and Factory Patterns, in order to help you clearly understand how they are used. 

    All right, once we've introduced ourselves to the field of design patterns in PHP, it's time to learn more about them. Thus, let's get started.

    More PHP Articles
    More By Alejandro Gervasio


       · This first tutorial explains some of the key points related to the Singleton and...
       · Would perhaps be more useful if you actually introduced patterned code in this first...
       · Hello,Yes, there are more articles to come, which introduce the usage of the...
       · class Singleton{ var $instance; function Singleton(){} function...
     

       

    PHP ARTICLES

    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT