What is an event-driven application?
An event-driven application is a computer program written to respond to actions generated by a user or system.
In a computing context, an event is any identifiable occurrence that has significance for system hardware or software. Events can be user-generated, such as a mouse click or keystroke, or system-generated, such as a program loading.
Event-driven programming separates event-processing logic from the rest of a program's code. The event-driven approach contrasts with batch processing. Because event-driven programming is a general development approach rather than a type of language, event-driven apps can be created in any programming language.
Examples of event-driven application design
Depending on the specific application, using an event-driven design can improve responsiveness, throughput and flexibility. In their book Event Processing in Action, authors Opher Etzion and Peter Niblett describe some purposes of event-driven applications.
Some applications are naturally centered on events. They involve some kind of sensor that detects and reports events, and the purpose of the application is to analyze and react to these events.
These applications need to identify and react to situations as they occur. An event-driven approach, in which changes in state are monitored as they happen, lets an application respond much faster than a batch approach, in which the detection process runs only intermittently.
Other applications analyze large amounts of data and provide output for delivery to a human user or another application. By treating the input data as events, an event-driven approach can distribute this analysis across multiple computing nodes.
Event-driven design can also extend an existing application in a flexible, noninvasive manner. Rather than changing the original application to add new functionality, developers can add event producers to the original application -- for example, by processing the log files it produces. The additional functionality can then be implemented by processing the events generated by these event producers.