Home arrow PHP arrow Working with Strings and the Composite Pattern in PHP 5

Working with Strings and the Composite Pattern in PHP 5

Are you a PHP developer who wants to improve your skills in pattern-based programming in PHP? If the answer to this question is an emphatic yes, then you should begin reading this article now! Welcome to the final part of the series “Implementing the composite pattern with PHP 5.” Comprised of two instructive tutorials, this series walks you through the basic concepts of this important design pattern, and shows you how to apply it with some educational examples.

  1. Working with Strings and the Composite Pattern in PHP 5
  2. Handling strings of data
  3. Defining the SingleStringProcessor and MultipleStringProcessor classes
  4. Putting all the classes to work together
By: Alejandro Gervasio
Rating: starstarstarstarstar / 3
March 14, 2007

print this article




Before I move forward and tell you about the topics that I plan to cover in this final installment of the series, first I’d like to revisit briefly the concepts deployed in the preceding article. This will give you a better idea of how both tutorials are linked to each other.

As you’ll certainly remember, in the first part of the series I introduced the foundations of the composite pattern, and also explained in detail how it could be applied. To quickly review its theoretical definition, in the composite pattern, one object or a set of objects will behave similarly across an application, regardless of the context where they will be used.

Of course, bearing in mind that the previous definition is in fact quite confusing, I demonstrated the application of the pattern in question by setting up a testing example. The example showed how two different file reading classes were able to generate nearly identical outputs, regardless of whether they used one or multiple file handling objects.   

However, I believe that the example that I mentioned previously isn’t good enough to give a reader a decent background on how this pattern works. Thus, since this series is aimed at mastering the basic concepts of the composite pattern, in this final article I’m going to demonstrate how to use it to handle strings of data.

By the end of this article, you should have a more solid foundation on how to apply the pattern in question as part of your own PHP applications.

With the preliminaries out of the way, let’s continue learning more about the composite pattern. Let’s get going!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


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