0% found this document useful (0 votes)
6 views3 pages

Event Driven Programming

Event-driven programming is a paradigm where program execution is determined by events like user actions or system messages, with applications designed to detect and handle these events. It can be implemented in various programming languages, particularly those with integrated development environments (IDEs) that automate code generation and provide built-in controls. While event-driven programming is prevalent in GUI applications, it may not be suitable for all software types, particularly those requiring minimal user interaction.

Uploaded by

siwesapepa02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Event Driven Programming

Event-driven programming is a paradigm where program execution is determined by events like user actions or system messages, with applications designed to detect and handle these events. It can be implemented in various programming languages, particularly those with integrated development environments (IDEs) that automate code generation and provide built-in controls. While event-driven programming is prevalent in GUI applications, it may not be suitable for all software types, particularly those requiring minimal user interaction.

Uploaded by

siwesapepa02
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Event-driven Programming

Event-driven programming is a programming paradigm in which the flow of program

execution is determined by events - for example a user action such as a mouse click,

key press, or a message from the operating system or another program. An event-

driven application is designed to detect events as they occur, and then deal with

them using an appropriate event-handling procedure. The idea is an extension

of interrupt-driven programming of the kind found in early command-line

environments such as DOS, and in embedded systems (where the application is

implemented as firmware).

Event-driven programs can be written in any programming language, although some

languages (Visual Basic for example) are specifically designed to facilitate event-

driven programming, and provide an integrated development environment (IDE) that

partially automates the production of code, and provides a comprehensive selection

of built-in objects and controls, each of which can respond to a range of events.

Virtually all object-oriented and visual languages support event-driven programming.

Visual Basic, C#, Visual C++ and Java are examples of such languages.

A visual programming IDE such as Visual Studio provides much of the code for

detecting events automatically when a new application is created. The programmer

can therefore concentrate on issues such as interface design, which involves adding

controls such as command buttons, text boxes, and labels to standard forms (a form

represents an application's workspace or window). Once the user interface is

substantially complete, the programmer can add event-handling code to each control

as required.

Many visual programming environments will even provide code templates for event-

handlers, so the programmer only needs to provide the code that defines the action
the program should take when the event occurs. Each event-handler is usually

bound to a specific object or control on a form. Any additional subroutines, methods,

or function procedures required are usually placed in a separate code module, and

can be called from other parts of the program as and when needed.

Types of Events

User initiated Events can be triggered by users, such as by clicking on an icon or


entering some text
System initiated In automated systems, sensors can be used to detect events such
as when a particular temperature is reached in a glasshouse or a specific water level
is detected on a flood defence system.

GUI programming

It should not be assumed that because most popular modern software applications

have a graphical user interface (GUI) that event driven programming is the right

solution for every programming requirement. Some software systems have a very

specific role that involves them carrying out some task to completion with little or no

user intervention (a C compiler, for example). Such applications are probably better

served by a procedural programming paradigm. Having said that, most mainstream

commercial software relies heavily on the availability of a GUI, and most GUI

software is designed to be event-driven.

A visual programming language such as Visual Basic and Visual C/C++ now comes

with an Integrated Development Environment (IDE) that provides an extensive array

of standard controls, each with its own set of events and event-handler code
templates. The task of the GUI programmer is thus twofold – to create the user

interface, and to write the event-handler code (and any additional code modules that

might be required).

The IDE provides the scheduler and the event queue, and to a large extent takes

care of the flow of program execution. The GUI programmer is thus free to

concentrate on the application-specific code. They will write the code required by

each control or object to allow it to respond to a specific event, but do not need to

know how to create the objects themselves.

You might also like