PHP
  Home arrow PHP arrow Using Self-Saving Objects with Command 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? 
PHP

Using Self-Saving Objects with Command Objects in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 7
    2006-12-26


    Table of Contents:
  • Using Self-Saving Objects with Command Objects in PHP 5
  • Defining a core module of the command pattern
  • Storing and loading self-saving objects
  • Completing the command pattern
  • Seeing the command pattern in action

  • 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


    Using Self-Saving Objects with Command Objects in PHP 5
    ( Page 1 of 5 )

    If you were looking for an approachable guide on how to create and use command objects with PHP 5, then look no further, because your search is over. Welcome to the final part of the series “Creating command objects with PHP 5.” Comprised of three comprehensive tutorials, this series walks you through the basics of how to apply the command pattern in PHP, and it accompanies its corresponding theory with numerous code samples.

    Certainly, one of the things that you’ll surely recall from the preceding article is the fact that implementing the command pattern with PHP is a quite straightforward process which can be carried out with minor problems. As you learned before, the procedure is only limited to defining a specific class, dubbed “commanded,” which will expose a method capable of encapsulating all the logic required for execution in another object. Lastly, this second object involved in the relationship is called a “commander,” and it will take care of invoking the mentioned method inside of its own scope. That's fairly understandable, right?

    Of course, one of the best courses of action to take when it comes to explaining the logic that stands behind the command pattern is to develop some concrete examples. In this way you can see how these objects interact with each other, as well as the neat functionality of this pattern.

    Now, and focusing my attention specifically on the topics that I plan to discuss in this final part of the series, I’m going to extend the creation and use of command objects to use the pattern in a more helpful fashion. Essentially, I’m going to explain how to utilize command classes for defining and handling self-saving objects, that is objects capable of storing a copy of themselves on a database, text file, etc.

    By doing so, I'll give you a much clearer idea of how the command pattern can be used in real-world applications, and at the same time you’ll expand your existing background in using design patterns with PHP 5 as well.

    With the preliminaries out of our way, it’s time to find out together how to use commanders in the creation of self-saving objects. The experience will be really educational, so let’s get started!



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

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





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