This Blog


Favorite Posts


Event-Driven Programming (Message from the CTO, newsletter 47)

You may have noticed that I’m on a JavaScript kick at the moment. My introduction to node.js and real async programming came out of that and I’m still amazed at it all.

Schrodinger's catphoto © 2006 Jie Qi | more info (via: Wylio)Event-driven programming

Event-driven programming? Haven't we been doing that since the dawn of time? Well, since Windows 1 at any rate? What's possibly new that we can talk about?

Let me approach it like this: multithreaded programming is hard, very hard. It suffers from data access and sharing issues, it seems to function under the Observer effect — the observer observing the system can change its state — leading to what is colloquially known as Heisenbugs. Yet, given the state of play of the CPU hardware at the moment, surely writing multithreaded programs is the only way to go to get the performance we need?

The answer is, surprisingly, no. Consider the new async functionality coming in C# 5.0. For a certain set of problems, the performance of a program is dependent on its I/O. Far too often a thread will sleep waiting for a read or write request to be completed and processing to continue. The C# 5.0 async functionality is designed to produce a simple way of doing asynchronous programming or "evented I/O". This allows us to write programs that do I/O in a fairly normal easy-to-read manner but that function as small request tasks with callbacks called when the request has completed. This, in turn, ensures that the CPU is being used at full-speed with minimal thread switching. Since the majority of work is being done on one thread, there are no real issues with the sharing and concurrency of data.

In the server world as well, there's a new player in town called node.js. Node is an encapsulation of the Google V8 engine that provides an evented I/O environment for JavaScript. On the server, not on the client. This environment allows programmers to create web servers (and other kinds of servers like ftp, irc, and the like) that scale to many concurrent users easily. The reason for the scalability is that the main process never waits. All I/O is done through issuing a request to a hidden event loop, with a callback being notified (and queued on the event loop) on completion.

So, I would recommend that you read up on asynchronous programming and evented I/O. You may be needing it sooner rather than later.

(You can watch the video here.)

Part of me wonders what a node-ified ASP.NET runtime would look like.

By the way, I shall be at Tech·Ed in Atlanta next week. If you’re going too, pop by the booth to say hello and so we can talk about DevExpress’ products and services.

Published May 12 2011, 03:47 PM by
Filed under:
Bookmark and Share


Bradley Chesbro

Just C# 5.0?  Not VB.Net?  Or is that just a C# bias showing?

I have read that the C# and VB.Net teams at Microsoft were merged so that new technologies would be rolled out in both .Net syntaxes simultaneously and that according to Microsoft they see roughly equal penetration of both .Net syntaxes in the marketplace.

May 12, 2011 9:40 PM

Julian Bucknall (DevExpress)

Bradley: you're completely correct. My biases are just showing.

Cheers, Julian

May 13, 2011 12:03 AM

About Julian Bucknall (DevExpress)

Julian is the Chief Technology Officer at Developer Express. You can reach him directly at julianb@devexpress.com. You can also follow him on Twitter with the ID JMBucknall.

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383


DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2018 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners