Event-driven Programming

In computer programming, event-driven programming (EDP) or event-based programming is a programming paradigm in which the flow of the program is determined by events—e.g., sensor outputs or user actions (mouse clicks, key presses) or messages from other programs or threads.

Event-driven programming can also be defined as an application architecture technique in which the application has a main loop which is clearly divided down to two sections:

  • the first is event selection (or event detection)
  • the second is event handling.

In embedded systems the same may be achieved using interrupts instead of a constantly running main loop; in that case the former portion of the architecture resides completely in computer hardware.

Event-driven programs can be written in any language, although the task is easier in languages that provide high-level abstractions, such as closures. Some integrated development environments, such as Microsoft Visual Studio, provide code generation assistants that automate the most repetitive tasks required for event handling.

Read more about Event-driven Programming:  Criticism and Best Practice, Stackless Threading

Other related articles:

Event-driven Programming - Stackless Threading
... processing an event, once done the cpu can move on to process other event-driven threads, that allows an extremely large number of threads to be handled ...

Famous quotes containing the word programming:

    If there is a price to pay for the privilege of spending the early years of child rearing in the driver’s seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.
    Melinda M. Marshall (20th century)