PHP
  Home arrow PHP arrow User-defined Interfaces in PHP 5: Turning MySQL Classes into Interface Implementers
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

User-defined Interfaces in PHP 5: Turning MySQL Classes into Interface Implementers
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2006-01-02


    Table of Contents:
  • User-defined Interfaces in PHP 5: Turning MySQL Classes into Interface Implementers
  • Working with different interface implementers: defining the “MySQL” class
  • Working with result sets: implementing the “HTMLRenderer” on result-type objects
  • Describing the logic

  • 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


    User-defined Interfaces in PHP 5: Turning MySQL Classes into Interface Implementers
    ( Page 1 of 4 )

    Welcome to the third part of the series “User-defined interfaces in PHP5.” In four parts, this series explains the use of interfaces in PHP5, highlighting their advantages and illustrating their implementation in real applications.

    Having developed a large set of (X)HTML widget classes that implement an “HTMLRenderer” interface, the previous article demonstrated the use of this interface through the specific definition of its abstract “toHTML()” method. In short, I’ve provided you with a technique for grouping objects of the same family type through a common interface.

    However, this fact itself does not give us a direct advantage in developing an application, because this functionality can be obtained by defining an abstract parent class, and then deriving some subclasses that either override or overload existing methods within the specific context of child classes.

    Fortunately, the existence of interfaces allows grouping objects of different family types, so if you’re working with objects that don’t belong to the same type, using a common interface to implement a specific functionality is probably the right way to go.

    Returning to this part of the series, I’ll demonstrate how useful interfaces can be, by implementing the “HTMLRenderer” interface on a couple of MySQL processing classes that have nothing in common with the (X)HTML widgets explained in the previous tutorial. In this way, by the end of this article you’ll have a decent background for working with interfaces as well as a clear idea about its concrete implementation in PHP applications.



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

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - 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





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