PHP
  Home arrow PHP arrow Expanding the Application Range of Vis...
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
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

Expanding the Application Range of Visitor Objects in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2006-08-09

    Table of Contents:
  • Expanding the Application Range of Visitor Objects in PHP 5
  • Visiting users isn't a bad idea after all: setting up a new practical example
  • Deriving a subclass from the User base class: creating sets of software user objects
  • Visiting software users isn't boring at all: creating a concrete visitor class
  • Putting the classes to work together: seeing the visitor object in action

  • 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


    Expanding the Application Range of Visitor Objects in PHP 5


    (Page 1 of 5 )

    Has your career as PHP developer led you to learn more about the most popular design patterns? If it has, then this series may help you get a better grounding in them. Welcome to the second installment of the series “Introducing Visitor Objects in PHP 5.” Made up of three articles, this series introduces the key points of how to apply the visitor pattern in PHP, and emphasizes the practical side of the topic by walking you though copious hands-on examples.

    Introduction

    If the word "visitor" doesn't ring any bells to you, let me tell you quickly what it means in the context of pattern-based programming. Essentially, a visitor object is one that's passed in straightly to another by a specific method, in order to inspect its properties and retrieve relevant information about this visited object.

    Since at first glance the theory about visitors can be sometimes pretty overwhelming, in the first tutorial of the series, I introduced an easy-to-follow example, which hopefully demonstrated by a friendly approach how to create visitors with PHP 5. The example in question showed how two data handling classes could be visited by a single visitor object, in order to obtain concrete data about them, without the need to invoke specifically any of its accessing methods.

    Although the example shown in the previous article may not fit all the needs of a real-world application, I think that one of the most important things here consists of understanding the primary logic behind constructing visitor objects, and then, when the pattern has been appropriately mastered, it can be used in more realistic situations.

    Well, at this stage I'm assuming that creating visitor objects with PHP isn't a strange concept to you any longer, therefore I'll continue this journey by developing some additional -yet useful- examples on how to build up and implement visitors with PHP 5. The main purpose of this is simply reaffirming the concepts deployed in the first tutorial, so you can have a solid background for including your own visitor classes inside your PHP applications.

    With the preliminaries out of our way, let's move on and continue learning more examples on how to use the visitor pattern in PHP. Let's go!

    More PHP Articles
    More By Alejandro Gervasio


       · Over the course of this second installment, I'll go deeper into the implementation...
       · I'm looking forward to this practical example.
       · Hello,The example has been included into the tutorial.Thank you.
       · In the last example, the lines: // visit 'SoftwareUser' object ...
       · Thank you for introducing your feedback regarding this article. Concerning your...
       · The comments by Anonymous Loozah at: 08-11-06 @ 5:03 am EST seem a bit harsh. ...
       · Hi Larry,First off, thank you for the compliments on this PHP article; I see you...
       · I agree with Larry, so want to thank Alejandro for writing these articles. It's very...
       · Hello Matthijs,Thank you for introducing your comments on my PHP article. In...
     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway