Introduction To Event Driven Programming
Introduction To Event Driven Programming
1. Callbacks: Callbacks are the most basic and widely-used approach to event-
driven programming. A callback function is registered to be called when a specific
event occurs. When the event occurs, the program invokes the appropriate
callback function to handle the event.
2. Observables: Observables are a more advanced approach to event-driven
programming that allows for more complex data flows. Observables represent
data streams that emit events over time. When a new event occurs, the program
reacts by propagating changes through the data stream.
3. Promises: Promises are a popular approach to handling asynchronous operations
in event-driven programming. A promise represents the eventual completion of
an asynchronous operation and allows the program to register callbacks to be
executed when the operation is complete.
4. Actors: Actors are a more complex approach to event-driven programming that is
based on the concept of concurrent, independent entities that communicate with
each other through message passing. Each actor is responsible for its own state
and processing, and communication occurs through asynchronous message
passing.
5. Reactive programming: Reactive programming is an approach that focuses on
the flow of data and the propagation of change. In reactive programming, the
program reacts to events by propagating changes through a network of data
streams. Reactive programming uses a functional programming style that
emphasizes immutability and declarative programming.
3. How is event driven programming different from the other programming approaches?