News Feed
Jobs Feed
Sections




News Archive
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

Lorna Mitchell's Blog: Building A RESTful PHP Server: Output Handlers

Debuggable Blog: Installing PHP5.3 via MacPorts

Evan Coury: Creating a simple view helper in Zend Framework 2

PHPBuilder.com: Using Ajax with PHP to Create an Interactive Web Page

DevShed: Parsing Web Document Nodes with the Tidy Library in PHP 5


Community Events











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


code interview phpunit framework zendframework2 podcast release tool language example introduction series unittest community development conference testing application functional opinion

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