Home arrow PHP arrow Working with Directory Iterators and Proxy Classes with PHP 5

Working with Directory Iterators and Proxy Classes with PHP 5

If you’re a strong advocate of using pattern-based programming for developing your PHP applications, then this pair of comprehensive tutorials might find a place on your quick reference list. Welcome to the concluding part of the series “Building Proxy Classes with PHP 5.” In two parts, this series introduces the foundations of how to apply the proxy pattern with PHP 5, and it accompanies the corresponding theory with extensive code samples.

TABLE OF CONTENTS:
  1. Working with Directory Iterators and Proxy Classes with PHP 5
  2. Defining the initial structure of a proxy directory class
  3. Improving the functionality of the proxy class
  4. Completing the proxy pattern
  5. Developing a final example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 4
January 09, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Before I go deeper into the subject of this final article, let me refresh quickly the topics that I covered in the preceding article. As you'll possibly recall, over the course of the first part of the series, I explained the core concepts related to applying the proxy design pattern in PHP 5.

However, if this pattern is still a pretty unfamiliar thing to you, allow me to explain briefly what it does. Basically, in the proxy pattern, a class (in this case, it's called "proxy") accesses all the methods that belong to other classes. In other words, the proxy acts like an intermediate entity for a selected object, a fact that reminds one closely the behavior of different proxy servers.

So, having defined the basic logic that drives this pattern, the question is: why would we use it? Well, to be frank, the pattern can be used in those cases where you want to avoid an unnecessary instantiation of a given class, which will be used only when the application you're working with really demands it. At first glance, this may seem like an insignificant benefit if you're trying to boost the overall performance of your web applications, but there are times that working with many objects at the same time can bring about a notable overload on the server.

So far, so good. Assuming that the proxy pattern isn't an unknown topic to you anymore, let me tell you what this final article is about. Since in the first part of the series I showed you how to create a proxy class for processing simple XML strings, in this installment I'm going to teach you how to create a proxy object that can be used in conjunction with the "DirectoryIterator" class that comes with PHP 5.

Does this sound interesting and educational to you? Then it's time to learn how to couple proxy classes and iterators. Let's get started!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: