[PEPr] Comment on PHP::PHP_Callback
| From: | Travis Swicegood | Date: | Thu, 03 May 2007 15:39:58 +0000 |
| Subject: | [PEPr] Comment on PHP::PHP_Callback | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-46583@lists.php.net to get a copy of this message | ||
Travis Swicegood (http://pear.php.net/user/tswicegood) has commented on the proposal for
PHP::PHP_Callback.
Comment:
I feel I need to explain this proposal a little better, my apologies for
not doing so in the first place.
The main motivation behind this class is type hinting and callback
validation; the ability to type hint for PHP_Callback object that has been
pre-validated lends itself to a much more OO design.
This does follow the Command pattern if you use Wikipedia's definition:
"... the Command pattern is a design pattern in which objects are used to
represent actions."
Had I just implemented PHP_Callback::execute($callback[, $param, ...]),
then yes this would be quite useless. However, by instantiating a
PHP_Callback, you verify that the object represents a valid action within
PHP's user-land. Calling addParameter() and/or addParameterByRef() you can
load the callback so it can be repeated multiple times.
I hope that helps clarify the intent.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=482
--
Sent by PEPr, the automatic proposal system at http://pear.php.net