Event-Driven Programming
Event-Driven Programming is the term where the flow of the code is determined by events (click, load and so on). It's one of the basic milestones of today's popular programming languages, such as C#, Java and many more; I won't dwell on all of them here. In Node.js and moreover in any kind of JavaScript project, you'll be using or have used event-driven processes. Whether it's a page onload or a button click event, this is something you have done, whether you knew it or not.
Let's make an example to the classic event-driven process and how its done in NodeJS:
- result = getJSONfromDestination();
- binddata(result);
The operation above requires a blocking I/O process (single-threaded operation that waits for the previously working synchronous code).
Now let's have a look at how we do the asynchronous way (a non-blocking I/O process).
- json_finished = function(result){
- binddata(result);
- }
- getJSONfromDestination(jsonfinished);
It starts working when you call the getJSONfromDestination method and send param as the function to json_finished.
This is how asynchronous operations are completed in mainly JavaScript projects and widely used in NodeJS projects. In the case of how things work in a step-by-step manner, we send params to functions to start working whenever and however we want.
You'll be using these kinds of asynchronous operations frequently, or in other terms the “Event-Driven Programming” style, in nearly all of your JavaScript oriented applications, not to mention coding like that is a “must-have” in NodeJS applications.
In the next article, we will be experiencing a realistic problem for a detailed look.

Dominique CejaPosted Jul 13, 2015, 10:23 AM
Great post
Gopi ChandPosted Jul 12, 2015, 2:41 PM
Good job
Sibeesh VenuPosted Jul 12, 2015, 8:16 AM
Nice share
Santhakumar MunuswamyPosted Jul 11, 2015, 11:48 PM
Nice article! Thanks for sharing
Sam HobbsPosted Jul 11, 2015, 7:05 PM
Event-Driven Programming reminds me of IBM's Event Driven Executive, an operating system that IBM was talking a lot about at about the time that Windows was born. EDX was born about 1981, before the original IBM PC that allowed Microsoft to develop to what it is.