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

Community News: Latest PECL Releases for 04.28.2009

Community News: Latest PEAR Releases for 12.07.2009

Site News: Popular Posts for the Week of 01.27.2012

Community News: Packagist Latest Releases for 12.22.2014

Community News: Packagist Latest Releases for 10.15.2012


Community Events

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


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

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