Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between action and event?

Tags:

oop

events

action

When a user submits a message, is it an action or event?

like image 785
Steven Avatar asked Mar 31 '10 01:03

Steven


People also ask

What is the difference between an event and a situation?

An event is just a specific time where actions happened, or activity went on. A situation includes an event, but also includes all the factors and circumstances involved with that event.

What is the difference between event and process?

The difference between events and processes is simple. Event: the idea that results could be traced back to one thing happening. Process: the idea that results occurred because of cumulative, long-term efforts.


1 Answers

A user only provides actions (pressing on buttons, making selections in dialogs etc.)

These actions get [sometimes] converted into events by the underlying framework. Events can be understood, conceptually, as [notification] "messages" sent to methods which have, implicitly or explicitly, "registered" with the underlying framework to be notified [for a specific type of event]. In reality the framework merely invoke these methods with the appropriate arguments, and such an invocation is effectively an event.

The word event is also used to designate a particular type of events. For example one speaks of the "Change" event or "Submit" event of a given edit box or other UI element. In this sense the event is not a particular instance of an opportunity for the underlying method to be called, but rather the generic set of conditions which warrant the method to be invoked.

The user therefore doesn't really "submit a message" as phrased in the question, he/she takes some actions upon various UI elements, and these action [may] result in the fact that the framework detects a particular event type (or several). The framework then looks-up which methods are currently registered to receive the corresponding notifications, and the framework then invokes these methods, passing the proper arguments (which constitute a "message" of sorts for use by the method).

The main idea behind this model is for the application-level to provide the specific logic to handle events but not worry about following the system and user's every "move". The framework does this, and can be trusted to notify the relevant event handlers would a particular user action (or system condition such as a timer reaching its set time, a network packet being received etc. etc.) warrant such notification.

like image 133
mjv Avatar answered Sep 27 '22 21:09

mjv