In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions, sensor outputs, or message passing from other programs or threads.
Simply put, event-driven programming is when a program is designed to respond to user engagement in various forms. It is known as a programming paradigm in which the flow of program execution is determined by “events.” Events are any user interaction, such as a click or key press, in response to prompt from the system. To visualize event programming more clearly, imagine the opposite of event-programming is a software that requires zero user interaction.
Events are monitored by a code (or function) known as an event listener. If the event listener detects that an assigned event has occurred, it will trigger a callback function, known as an event handler, which will perform said event, e.g. clicking (the event) a “print” button (event listener) activates the actual print process (event handler).
Web-based applications have come a long way since we used to serve static HTML content from servers. Nowadays, applications are much more complex and use multiple frameworks, data centers, and technologies. In the last couple of years, we’ve seen two concepts dominate the IT market:
- moving our apps to the cloud;
- implementing a microservices architecture;
These ideas have shaped the way we design and build software. In a way, we are no longer building applications; instead, we are building platforms. Apps no longer share the same computational space. Instead, they have to communicate with each other through lightweight communication protocols, like REST APIs or RPC calls. This model made it possible to create some amazing software like Facebook, Netflix, Uber, and so many others.