Home arrow PHP arrow More Examples of Creating Command Objects with PHP 5

More Examples of Creating Command Objects with PHP 5

Are you one of those PHP developers who wants to expand your background in design patterns by learning an additional one? If your answer is affirmative, then this series might be appealing to you. It will teach you, in three educational tutorials, how to create and implement command objects with PHP 5.

  1. More Examples of Creating Command Objects with PHP 5
  2. Building an array command class
  3. Creating two more command classes
  4. Building an array commanded class
  5. Including all the classes in one hands-on example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
December 19, 2006

print this article



Frankly speaking, the application of the command pattern with PHP is an accessible topic that seems to be much harder to grasp than what it really is. Essentially, the logic that stands behind the referenced pattern will allow you to establish a carefully-crated relationship between at least two objects, where the first one, usually called the commanded, presents a specific method coded in such a way that it houses all the logic required for being called into another object, in this case named "commander."

Since the previous definition looks rather difficult to grasp, at least at first glance, the best course of action to take in this case is simply to annex to the corresponding theory into some comprehensive examples. In this way the mentioned pattern can be understood much more clearly, and at the same time, it brings new possibilities for including it into complex applications.

Naturally, in the previous article I followed the learning methodology that I mentioned above by defining some command classes, which were originally capable of instructing a commanded object on how to display a specified input string. Of course, the examples were rather primitive and they should be considered only like that. However, it's important to mention here that all the code samples that I wrote previously came in really handy for demonstrating by an understandable approach, how to create and use command objects with PHP.

Now, and turning special attention to this second article of the series, I'll develop a few more hands-on examples concerning the pattern in question, thus you can reaffirm the concepts learned in the preceding installment.

With the theme of this article already established, let's continue exploring the creation of command objects in PHP 5. Let's get started!

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