What is an event?

Asked

Viewed 841 times

10

Much is heard of events:

  • Trigger events;
  • Schedule events;
  • Trigger events...

Although much is found on the internet, none brings a concrete definition of what is really an event in programming. So what is an event in programming for what they serve and where they are used?

  • According to the https://en.wikipedia.org/wiki/Event_(computing), an event is an action recognized by the Software that can be manipulated. Although I understand (or think I understand kkk) what an event is, I am not able to give a complete answer, that this answer deserves, so I only leave my contribution here :)

2 answers

9


In computing, an Event is an action or Occurrence recognized by software that may be handled by the software

So according to Wikipedia is an action or occurrence recognized by the application that needs to be manipulated by this application.

Being more direct is an event, something that has changed state, or executed something that must determine a possible other action not directly related. An event may be generated by hardware or some software component, including its own application.

The event, in the context that seems to ask, is the whole mechanism that allows you to notify other areas of the application that want to know that something specific has happened.

Examples

An event is a pressed key, a move of a mouse, a button of a joystick, a data input into the microphone, scanner, network, installation of some device, a notification ide a service, relevant operating system information that needs to be handled immediately, an event of an API such as GUI, database, file system (a file was created, modified, deleted, accessed, etc.), or web service, such as Github informing that there was a commit, or in your application where the bank account needs to be notified when a deposit is made, or a customer makes a purchase greater than a value. It’s full of examples in the other questions linked here.

Every GUI system is one of the greatest examples. In Windows everything that happens that your application should know is sent a message to it telling what happened for the application to decide what to do. This is an event, although it is not customary to carry this name, even for not adopting the specific paradigm.

Recently picked up fashion serving HTTP by events (Nginx, Node.js are the best known, but almost all Stacks do so now). The advantage of this is that the application does not wait for something to happen, it responds to the need when the event is triggered.

The event is a very simple mechanism indeed, but with powerful results. This can be seen in more detail in links down below.

Learn more about event-oriented programming.

The events are a way of implementing the observer standard.

About the Event handlers.

See also Listeners are an Observer implementation?.

3

"Event" is usually the same as function or Procedure, ie, are code blocks with specific objectives. What happens is that the term event is more related to parts of the application that there will be external iteration (human or not) triggering this event.

This is very clear in applications that have the construction of interfaces, as the basic visual, where has the components (button for example) and this button has the "event" of "click on the button".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.