Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
An event is an action launched by an external hardware device and manipulated by software code. Events allow objects to notify client objects about important activities. Events provide tremendous flexibility compared to traditional console applications, which follow a rigid execution path and are limited by hard wiring. Unlike fields, events are members of an interface.
A class sending an event message is the publisher. A class receiving the event is the subscriber. Events may only be invoked from their declared classes, which requires modifier declaration (for example, protected virtual) enabling derived class access.
Programs apply event-driven code as external asynchronous changes occur. For example, a user pressing a keyboard button causes an external change requiring a response from its software. The triggered event is either external hardware or software. When a program indicates it is ready to react, the event is redirected to the event handler software module.
Optionally, a program may ignore and redirect events to available handlers. Triggered hardware or software event data are event type indicators, but data like precise event time or extra data affects final event handler response.
Events are always considered when hardware converts external user actions into specific event code, especially during user interface design and manufacturing.
Program event handlers are often synchronous, where one or more program code modules are dedicated to event handling. Common event sources are:
Event-driven interactive software alters responses according to events.
One event may be published by multiple publishers. One subscriber may handle multiple publisher events. When multiple subscribers are registered for a single event, handlers are invoked synchronously.
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.