Event Driven Programming
Key Features
Event Driven Programs
Typically used for most modern day
software applications examples include:
word processing, spreadsheets, drawing
packages etc.
Usually used for GUIs where many types
of events are generated i.e. clicking on a
button or another object
Key features
 Event Handlers
 Trigger Functions
 Events
 Event Loops
 Forms
 Flexibility
 Service oriented
 Suitability for GUIs
 Simplicity of programming
 Time Driven
Event Handlers
VB.Net uses subroutines for event
handling, with the name of the object
followed by the name of the event – see
below:
Event
Event
Handler
Trigger functions
 These are used along with the object’s name to determine with event handler to run
 Every object has a range of trigger functions, one for each possible event that can
happen to it. For example, txtText could have an event handler for the following
triggers: GotFocus, TextChanged etc...
 Temporal triggers mean triggers set off by duration of time
 State triggers are when the current situation causes a certain set of procedures to run
 What is the trigger here??
Event Loops
 Event Driven Programs have event loops built into the
environment. The loops keep testing the interface to
detect whether anything has happened, such as clicking
on a button or typing into a textbox etc.
 Event Loops are also known as event listeners
Flexibility
Programmers have enormous control over
where to place code and how to start it.
Every object has a good choice of events
that a program can respond to. These
events give an excellent level of control
over exactly what the program will respond
to when the user does something
Service Oriented
 A lot of networked applications use service oriented
techniques so that different applications can reuse code
components.
 Service oriented applications separate the service
implementation from the program interface that uses the
service.
 An example is a request from a database.
 XML (Extensible Markup Language) is commonly used
for interfacing with such service oriented architectures.
Time Driven
Time driven programming is often used in
real time, where code execution is
controlled by the computer clock.
A program is divided into a set of tasks
that need to be regularly activated. The
activation pattern us stored into a dispatch
table, where rules are used to schedule
the tasks.
Descargar

Event Driven Programming