PHP
  Home arrow PHP arrow Design Patterns in PHP - Factory Method and Abstract 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 
iPad news and developer info.
Ads by affinity 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Forums Sitemap 
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? 
Google.com  
PHP

Design Patterns in PHP - Factory Method and Abstract Factory


By: David Fells
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 73
    2004-12-20


    Table of Contents:
  • Design Patterns in PHP - Factory Method and Abstract Factory
  • Factory Method
  • Abstract Factory
  • Drawbacks of the Example
  • Conclusion

  • 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


    Summary: Normally, in object oriented programming, object creation is not difficult. But what if your object needs to be created based on different conditions or other matters of context? Then you will spend hours in debugging and updating--unless you know about design patterns. David Fells explains how they work, and uses the creation of a maze to illustrate his points.

    Design Patterns in PHP - Factory Method and Abstract Factory
    (Page 1 of 5 )

    Overview

    In object oriented programming, object creation - also known as instantiation - is an implied requirement. Objects must at some point be created for use. Obviously, creating objects is not a difficult task and most languages, PHP included, have simple and intuitive syntax for doing so.

    When developing larger, more complex systems though, object creation can become difficult. There are situations where different objects may need to be created based on different conditions or based on the context of the object creating it. Creating objects of concrete types explicitly in code can make these situations a nightmare when it comes time to make revisions and additions. When a new class is introduced, you get to follow a trail of code and commence the hours of debugging that will inevitably follow such an endeavor. This is where design patterns come in.

    This article will discuss the usage of Factory Method [DP107] and Abstract Factory [DP87] as they pertain to developing applications in PHP using object oriented programming techniques.



     
     
    >>> More PHP Articles          >>> More By David Fells
     

       

    PHP ARTICLES

    - PHP Excel Customizations: Working with Formu...
    - MVC and the Zend Framework
    - PHP: Rendering Web Pages Using the Composite...
    - PHP: Creating Dynamic Web Pages with the Com...
    - Secure Encrypting and Decrypting for Your PH...
    - PHP: Creating Single View Objects with the C...
    - PHP: View Object Collections and the Composi...
    - Securing Your PHP Website
    - Determine Link Relevance and Unique Class C ...
    - PHP Composite View Design Pattern: Introduci...
    - Facebook PHP API Applications: A Second Look
    - Secure PHP Programming
    - Facebook PHP API Applications: Basic Introdu...
    - SOAP Servers and Web Services
    - Using XPath, SOAP, and More with Web Services


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code



    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek