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 Releases from PHPClasses.org

Community News: Packagist Latest Releases for 05.12.2013

Job Posting: Software International (Recuriter) Seeks Sr. PHP Developer (Toronto, Canada)

Community News: Latest PECL Releases for 05.22.2012

Site News: Blast from the Past - One Year Ago in PHP


Community Events





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


community security tool composer symfony library version framework package update laravel mvc introduction interview podcast language series opinion release voicesoftheelephpant

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