Monday, December 03, 2007

Event-Driven (R)evolution

If history proves to offer a glimpse of the future, perhaps we might find that event-driven programming is soon to revolutionize web-based computing. Consider history.

In the not so distant past, a command-line-interface using procedural programming was the environment for most user-oriented software. Note the following illustration:






This implied that user interactions were limited and predictable. As it became apparent that this implication was far from being correct and device drivers adopted common standards, event-based programming became possible. This led to the revolution of GUI-based desktops and event dispatching of GUI-based events. All of the sudden, real-time events were being exposed to the user and the user could now interact with the system as the events happened. This sounds innocent enough at first, but this was revolutionary to those who were there and remember when the Mac presented you with an instant dialog showing the contents of a disk as it was inserted rather than requiring you to insert a disk, mount a volume, then query for content.

Ahhh, the good life of GUI and event-based computing. No longer did a developer have to try to predict every step a user would take. Now, all a developer had to do was write a monstrous event loop, including a huge switch statement, and monopolize system resources as each event was handled, as illustrated below:






Sometimes developers were nice enough to share time with other processes, but not always. Then Microsoft Windows and other GUI environments came along and took the event loop out of the hands of the developer and required the developer to only respond to the events of interest, noted below:




What a revolution!

Web-based applications appear to be following a similar path. From simple request/reponse interactions to the quagmire of state-machines, back-button-nightmares, and browser inconsistencies, Web applications are finally turning the corner to the point of becoming responsive systems that present events to users as the events happen.

Ajax frameworks with push-based technologies such as HTTP-streaming and Comet might just be the (r)evolution that makes Web history.

No comments: