PHP
  Home arrow PHP arrow Introducing Builder Objects in PHP 5
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? 
Google.com  
PHP

Introducing Builder Objects in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2006-10-04


    Table of Contents:
  • Introducing Builder Objects in PHP 5
  • Building basic XML documents: definition of the target object
  • Of builders and XML pages: the programmatic creation process
  • Taking control of the process: a director class
  • Putting all the classes to work together

  • 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


    Introducing Builder Objects in PHP 5
    ( Page 1 of 5 )

    In this article, the first of a three-part series, you will be introduced to the basics of creating directors and builder objects with PHP 5. As usual, there will be copious examples to help you quickly start using the builder pattern in your own PHP projects.

    Introduction

    In PHP, as with many other trusted programming languages out there, there are many ways to establish diverse relationships between objects during the development of an application. This concept has an immediate implementation in well-known circumstances within the context of object-based programming, particularly in those cases where both aggregation and composition play a relevant role.

    More specifically, if you’ve been using classes inside your PHP applications for a while, then you’ll know that there are several programming environments where a particular object isn’t completely independent. It requires the “assistance” of one or many additional objects to perform a given task.

    As I expressed earlier, composition and aggregation are clear examples of well-defined object interaction, but they're definitely not the only ones that exist in the object-based universe. Even without having a thorough theory that backs you up (using only your common sense), certainly you can conceive of numerous ways for two or more objects to perform a mutual (and productive) interaction, with no need to read thick books on object-oriented programming.

    Now, and particularly when using PHP 5, I’d like to introduce a concept that’s strongly related to a specific interaction between multiple objects. In this case, I’m talking about directors and builder objects, which when evaluated in conjunction, conform to what is commonly known as the “builder” pattern. But right now you’re probably wondering how the builder pattern works.

    Well, to put things in a simple perspective, when the builder pattern is applied, two objects are put into action to create a third one. First, these two objects create a director; as its name suggests, the director controls all aspects of the creation process and determines what pieces and modifications will be introduced into the target object. Finally, a builder is tasked with constructing the third object in question, in accordance with particular specifications. Sounds fairly simple, doesn’t it?

    Since you might have to address specific issues by applying the mentioned builder pattern eventually, in this series you’ll learn how to use it, and of course how to get the most out of it.

    Are you ready to learn more on how to use directors and builder objects in PHP? Let’s get started!



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

       

    PHP ARTICLES

    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - 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 ...





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