. Updated Daily. Editions SDA India   SDA Indonesia
JAX Asia 2008 - Conference for Enterprise Java, SOA, Spring, Web Services, Ajax, Agile and more
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Monday, 12 March 2007

Article: Learn About the Composite Pattern in PHP 5

 

 

Alejandro Gervasio, in the first article of a two part series introduces you to the basic concepts of the composite pattern. He says, over the course of these two tutorials, he is going to demonstrate how this pattern works by setting up code samples, which will help understand the topic more clearly.

He explains in crude terms that when the composite pattern is applied in the context of a given application, one single object or a group of these objects will expose a nearly identical behavior. In other words, he says this means simply that it's possible to build a class in such a way that it will be capable of returning to client code the same output, regardless of whether the class in question works with one or with multiple objects.

In the following steps he shows how to implement this composite pattern with PHP 5:

  • Introducing the basics of the composite pattern: in accordance with the schema established by the composite pattern, one or a group of objects that belong to this class will behave similarly in the context of a PHP application. He demonstrates this with example codes
  • Implementing the composite pattern's model: in the next step he shows how to carry out the implementation of the composite pattern based upon deriving two subclasses from the parent ‘FileInfoReader’ class
  • Seeing the composite pattern in action: in this step he develops a testing script, which will show that the two subclasses defined in the previous section will behave similarly, regardless of the context where they'll be used

 

Read the Post

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2008 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use