+ All Categories
Home > Documents > Event Driven Complete

Event Driven Complete

Date post: 21-Jul-2016
Category:
Upload: anamariana10
View: 218 times
Download: 1 times
Share this document with a friend
Description:
This is a note For subject Programming Pradigm.
15
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
Transcript
Page 1: Event Driven Complete

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

Page 2: Event Driven Complete

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.

Page 3: Event Driven Complete

• 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.

Page 4: Event Driven Complete

Purpose

Page 5: Event Driven Complete

PurposeWith 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 mousePressing a labelled buttonEntering text into a text field

Page 6: Event Driven Complete

• 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.

Page 7: Event Driven Complete

• 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.

Page 8: Event Driven Complete

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).

Page 9: Event Driven Complete

• 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.

Page 10: Event Driven Complete

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.

Page 11: Event Driven Complete

Differences with other programming

Page 12: Event Driven Complete
Page 13: Event Driven Complete
Page 14: Event Driven Complete

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

Page 15: Event Driven Complete

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


Recommended