News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Web Builder Zone:
Real-life closures examples...for real
December 17, 2010 @ 08:19:07

On the Web Builder Zone (from DZone.com) Giorgio Sironi has a new post about closures with some real life examples...no really, real ones.

I wrote an article long time ago about array_map(), array_filter(), and they are very handy in some cases, but I discovered there is a catch: they do their best when you already have a defined function to pass them. [...] So here's my real real-life example for closures: in my opinion, they are not meant for substituting foreach(), but for example to pass a curried callback method around (an implementation of the Command pattern).

His implementation uses the Command design pattern to create both Car and Truck objects that can use the Pump object for their tirePressure.

0 comments voice your opinion now!
closure tutorial example command designpattern


blog comments powered by Disqus

Similar Posts

Inside Open Source: Two New Articles (Date/Time & Services_Google)

DevShed: Creating a Blog Application with Interpreter Classes with PHP 5

Richard Thomas' Blog: Pjq becomes jQPie - jQuery PHP interface extension

NETTUTS.com: Building a 5 Star Rating System with jQuery, AJAX and PHP

Cory Fowler: Enabling PHP 5.4 in Windows Azure Web Sites


Community Events

Don't see your event here?
Let us know!


composer framework part2 application performance interview release configure conference series introduction community php7 podcast voicesoftheelephpant opinion laravel symfony2 api example

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework