EVENT DRIVEN PROGRAMMING
NUR ATHIRAH BINTI MIMOL D20111048162
NURUL SYUHADA BINTI MAZLINA D20111048161
NOR SUHAIBAH BT ABDUL WAHAD@WAHAB D20111048212
NORSHAFILAH BINTI RAMLI D20111048176
NOR HAFIZA BINTI UTHMAN D20112052115
Event driven programming
• is a programming paradigm in which the flow of the
program is determined by events such as user
actions (mouse clicks, key presses), sensor outputs,
or messages from other programs/threads.
• Event-driven programming is the dominant paradigm
used in graphical user interfaces (GUI) and other
applications (e.g. Javascript web applications) that
are centered around performing certain actions in
response to user input.
Purpose
Purpose
With the development of a program with a graphical
user interface (GUI) normally you want something to
happen when the user performs certain actions, for
example:
 Clicking on an area of the interface using the mouse
 Pressing a labelled button
 Entering text into a text field
• In each of these cases, a program 'event' occurs, and
the program can be designed to incorporate specific
actions that would occur when different events
occur. This type of program is referred to as an event-
driven program.
• In event-driven programs, the program is said to run
in a 'main loop', referred to as an event loop.
• When some user input occurs, then the program
responds appropriately. The program will be in one
state prior to the event occurring, and will usually be
in a different state after the program has responded
to the event.
Characteristics of event driven
programming
• Can be written in any programming languages
• Event-driven approach contrasts with batch processing. Because
event-driven programming is an approach rather than a type of
language, event-driven apps can be created in any programming
language.
• Event-driven processing can improve responsiveness, throughput
and flexibility.
• Events are generally referenced, indexed, or named based on an
object (noun) and the type of action that triggered the event. For
example, "icon3_click" or "icon3 - onClick". Thus, they usually have
at least two "keys" (in an informal sense).
• The task is easier in languages that provide high-level
abstractions.
• Windows-based applications or programs are being
regard as event-driven. For example, when the end
user chooses menu items, clicks the mouse and move
objects on the screen.
• With the advent of the World Wide Web (WWW),
event-driven programming has gained in popularity as
a way to add interaction to web pages.
Example :
Event handler  Refer to application responds to the
events which executing particular code
for each type of event.
Input  Come from event sources.
Source of an event  Modeled as an object
 Example: button click’s object is a button.
Type of the event  Example : ActionEvent, WindowEvent,
MouseEvent
 ActionEvent: passed to application which
contain info about the action.
Differences with other programming
Advantages
 It allows for more interactive programs
 It allows sensors and other hardware to easily
interact with software
 It can be implemented using hardware interrupts,
which will reduce the power used by the computer
 Flexibility
 Very user friendly and highly interactive systems
 The lack of concurrent data access
Disadvantages Event-Driven Programming
• Event Driven Programming is often more complex
and cumbersome than batch programming
• The flow of the program is usually less logical and
obvious
• Classes are often not reusable or hard implement in
other applications
• Generally only useful in GUI programming
• Is often not portable to other operating system, such
as in the case .NET framework under windows that
uses event driven programming

ilide.info-event-driven-complete-pr_2038c0d3570030ce3ea1533883938682.pdf

  • 1.
    EVENT DRIVEN PROGRAMMING NURATHIRAH BINTI MIMOL D20111048162 NURUL SYUHADA BINTI MAZLINA D20111048161 NOR SUHAIBAH BT ABDUL WAHAD@WAHAB D20111048212 NORSHAFILAH BINTI RAMLI D20111048176 NOR HAFIZA BINTI UTHMAN D20112052115
  • 2.
    Event driven programming •is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads.
  • 3.
    • Event-driven programmingis the dominant paradigm used in graphical user interfaces (GUI) and other applications (e.g. Javascript web applications) that are centered around performing certain actions in response to user input.
  • 4.
  • 5.
    Purpose With the developmentof a program with a graphical user interface (GUI) normally you want something to happen when the user performs certain actions, for example:  Clicking on an area of the interface using the mouse  Pressing a labelled button  Entering text into a text field
  • 6.
    • In eachof these cases, a program 'event' occurs, and the program can be designed to incorporate specific actions that would occur when different events occur. This type of program is referred to as an event- driven program.
  • 7.
    • In event-drivenprograms, the program is said to run in a 'main loop', referred to as an event loop. • When some user input occurs, then the program responds appropriately. The program will be in one state prior to the event occurring, and will usually be in a different state after the program has responded to the event.
  • 8.
    Characteristics of eventdriven programming • Can be written in any programming languages • Event-driven approach contrasts with batch processing. Because event-driven programming is an approach rather than a type of language, event-driven apps can be created in any programming language. • Event-driven processing can improve responsiveness, throughput and flexibility. • Events are generally referenced, indexed, or named based on an object (noun) and the type of action that triggered the event. For example, "icon3_click" or "icon3 - onClick". Thus, they usually have at least two "keys" (in an informal sense).
  • 9.
    • The taskis easier in languages that provide high-level abstractions. • Windows-based applications or programs are being regard as event-driven. For example, when the end user chooses menu items, clicks the mouse and move objects on the screen. • With the advent of the World Wide Web (WWW), event-driven programming has gained in popularity as a way to add interaction to web pages.
  • 10.
    Example : Event handler Refer to application responds to the events which executing particular code for each type of event. Input  Come from event sources. Source of an event  Modeled as an object  Example: button click’s object is a button. Type of the event  Example : ActionEvent, WindowEvent, MouseEvent  ActionEvent: passed to application which contain info about the action.
  • 11.
  • 14.
    Advantages  It allowsfor more interactive programs  It allows sensors and other hardware to easily interact with software  It can be implemented using hardware interrupts, which will reduce the power used by the computer  Flexibility  Very user friendly and highly interactive systems  The lack of concurrent data access
  • 15.
    Disadvantages Event-Driven Programming •Event Driven Programming is often more complex and cumbersome than batch programming • The flow of the program is usually less logical and obvious • Classes are often not reusable or hard implement in other applications • Generally only useful in GUI programming • Is often not portable to other operating system, such as in the case .NET framework under windows that uses event driven programming