Event-driven programming

In, event-driven programming is a in which the  is determined by s such as user actions ( clicks, key presses),  outputs, or  from other programs or. Event-driven programming is the dominant paradigm used in s and other applications (e.g., JavaScript s) that are centered on performing certain actions in response to. This is also true of programming for s (e.g., in USB device driver stacks).

In an event-driven application, there is generally a that listens for events, and then triggers a  when one of those events is detected. In s, the same may be achieved using s instead of a constantly running main loop. Event-driven programs can be written in any, although the task is easier in languages that provide , such as and.

Common uses
Most of existing GUI development tools and architectures rely on event-driven programming. The Java AWT framework processes all UI changes on a single thread, called the. Similarly, all UI updates in the Java framework occur on the JavaFX Application Thread.

In addition, systems such as Node.js are also event-driven.

Criticism
The design of those programs which rely on event-action model has been criticised, and it has been suggested that the event-action model leads programmers to create error-prone, difficult to extend and excessively complex application code. Table-driven s have been advocated as a viable alternative. On the other hand, table-driven state machines themselves suffer from significant weaknesses including phenomena.