News Feed
Sections




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

Francois Zaninotto's Blog:
Node.js for PHP Programmers #1 Event-Driven Programming... and Pasta
January 26, 2012 @ 08:35:41

On his blog today Francois Zaninotto has a post that aims to introduce those with a PHP background to how Node.js works. In this first part of his series, he tries to explain the idea of event-driven programming - parallel processing of different parts of an application based on some action taken in the code.

For a PHP developer, asynchronicity is the most puzzling aspect of the Node.js runtime. It's simply a new way to write programs. And once you pass the first learning steps, event-driven programming opens a world of possibilities PHP programmers would never dream of. I'll try to explain you how it works, but first, let's talk about pasta.

In his "pasta" example, he shows how a typical PHP application would make a "Pan" object, call a "warm" action, "add olive oil", etc. All of this happens in sequence, though and takes 29 "minutes" to complete. To help things along, he implements an "EventLoop" class that handles tracking the timing and includes two methods to execute callbacks and delayed methods. He expands on this example with asynchronous objects and method calls to handle multiple things at once. He relates this to what Node.js offers - a built in event handling system, an included EventLoop object and native blocking I/O operations.

0 comments voice your opinion now!
nodejs programmer eventdriven pasta asynchronous


blog comments powered by Disqus

Similar Posts

Site News: Popular Posts for the Week of 10.30.2009

Community News: Latest PEAR Releases for 08.02.2010

Community News: Latest Releases from PHPClasses.org

Community News: Latest PEAR Releases for 05.14.2012

Community News: Packagist Latest Releases for 06.11.2014


Community Events





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


development zendserver framework code podcast conference community symfony api list threedevsandamaybe laravel bugfix language deployment introduction series interview tips release

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