Home arrow PHP arrow Handling File Data with the Facade Pattern in PHP 5

Handling File Data with the Facade Pattern in PHP 5

Are you interested in learning the foundations of different structural patterns in PHP 5? If your answer is affirmative, then you should start reading this article immediately! Welcome to the last installment of the series “Introducing the Facade Pattern in PHP 5.” In two consecutive articles, this series shows you how to create and use facade classes in PHP-based development environments.

TABLE OF CONTENTS:
  1. Handling File Data with the Facade Pattern in PHP 5
  2. Using the facade pattern to handle file data
  3. Applying the facade pattern to a string processor
  4. Putting all the classes to work together
By: Alejandro Gervasio
Rating: starstarstarstarstar / 5
January 23, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

As you know, PHP 5 allows you to create web applications that implement a diverse range of design patterns, logically including that one called “facade.” If you’ve not yet read the first part of this series and don’t know what this pattern is about, then let me offer you a brief introduction.

Essentially, in the facade pattern a class is created in such a way that it’s able to hide all the complexity inherent to a given mechanism, in order to perform a specific task. This mechanism (usually comprised of one or more classes) is completely independent from the calling class, and knows nothing about it. As you might guess, even though this theoretical definition may sound a bit complex, the truth is that creating facade classes with PHP 5 is an easy process.

To clarify possible questions on how this pattern works, in the first part of the series I worked in a step-by-step format to define a simple façade class. The class was capable of compressing a diverse range of contents, including all the source code created by a web page generator class.

The most important part of this facade class was logically the one related to hiding all the complexity involved in compressing the (X)HTML output of different web documents by using a pair of additional classes. In accordance with the logic dictated by the pattern, these supporting classes were entirely independent of the facade. They were tasked only with compressing any number of input strings passed as parameters to a specific method.

Now that you hopefully recalled the topics covered in the preceding article, it’s time to pay attention to the subject of this one. I’m going to continue demonstrating the application of the facade pattern, this time by developing yet another illustrative application. It will take care of processing the contents of a selected data file in different ways.

So how does a facade class fit into this schema? Start reading to find out!



 
 
>>> 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: