Event-driven programming

Slides:



Advertisements
Similar presentations
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
Advertisements

PIIT Computer Science Summer Camp - Alice July 11, 2012 Brenda Parker Computer Science Department MTSU.
Alice Inheritance and Event Handling. Inheritance Concept Consider this hierarchy; parents describe properties of children Animals Vertebrates MammalsFish.
Events Chapter 7. Interactive Real world is interactive User determines order of actions instead of programmer.
Winter 2007ACS-3913 Ron McFadyen1 Also known as publish/subscribe The essence of this pattern is that one or more objects (called observers or listeners)
Fall 2007ACS-1805 Ron McFadyen1 Ch 7 Loops Alice has two control structures for controlling the repeated execution of statements Loop While.
Fall 2009ACS-1805 Ron McFadyen1 Ch 7 Loops Alice has two control structures for controlling the repeated execution of statements Loop While.
Fall 2009ACS-1805 Ron McFadyen1 Functions A function is a collection of statement, similar to a method, but a function is defined to return a value to.
Fall 2009ACS-3913 Ron McFadyen1 Decorator Pattern The Decorator pattern allows us to enclose an object inside another object. The enclosing object is called.
Fall 2009ACS-3913 Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
Fall 2008ACS-1805 Ron McFadyen1 ACS-1805 Introduction to Programming using Alice 2.0 Ron McFadyen Course OutlineMcFadyenOutline.
1 Fall 2007ACS Fall 2007 Text: Starting out with java from control structures through data structures Gaddis & Muganda Instructor: Ron McFadyen.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 5 Interactive Programs.
Fall 2007ACS-1805 Ron McFadyen1 Functions and if-else A function is a collection of statement, similar to a method, but a function is defined to return.
Fall 2008ACS-1805 Ron McFadyen1 Ch 8 Recursion Recursion occurs when a method (or function) calls itself.
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
Fall 2007ACS-1805 Ron McFadyen1 Boolean functions & expressions A boolean function is one that returns true or false The guidelines for class-level methods.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 7 Repetition.
Fall 2007ACS-1805 Ron McFadyen1 Ch 7 Loops Alice has two control structures for controlling the repeated execution of statements Loop While.
Fall 2009ACS Ron McFadyen1 The context maintains an instance of a concrete state subclass State Pattern Each subclass (concrete state) implements.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 3 Programming - Putting Together the Pieces.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 8 Recursion.
Spring 2010ACS-3913 Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Fall 2009ACS-1805 Ron McFadyen1 ACS-1805 Introduction to Programming using Alice.
Winter 2007ACS-3913 Ron McFadyen1 Observer Pattern Problem: There are many objects (observers / subscribers) needing to know of the state changes, or events,
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Fall 2007ACS-1805 Ron McFadyen1 Ch 9 Lists In some animations, several objects must perform the same actions Example: A marching band, where the band members.
CS320n –Visual Programming Interactive Programs Mike Scott (Slides 5-1)
Fall 2007ACS-1805 Ron McFadyen1 Chapter 4 OO Programming Concepts.
Interaction: Events and Event Handling
Fall 2007ACS-1805 Ron McFadyen1 Chapter 6 Functions & If/Else.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 3 Programming.
Execution Control with If/Else and Boolean Functions
CompSci 4 Chap 5 Sec 1 Oct 13, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
Alice: Functions Alice Chapter 6 September 19, 2005.
Interaction: Events and Event Handling
Event Driven Programming Chapter 5. Sequential Programming Computer-Centric Computer-Centric Program Runs as Programmer Intended Program Runs as Programmer.
Protecting life, environment and property… 1 AutroMaster 5000: Version 4.0 Operation ID: AM5000_operation_eng_
Events (2) (Alice In Action, Ch 6) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
Today’s Agenda 1.Collect Pre-Lab 5 2.Collect Alice project storyboards 3.Events 4.Dummy Objects 5.Assign pair programming teams and meet upstairs for Lab.
Interactive Programming Sec 49 Web Design. Objectives The student will: Understand the difference between movie mode and an interactive program Understand.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
MS Visual Basic 6 Walter Milner. VB 6 0 Introduction –background to VB, A hello World program 1 Core language 1 –Projects, data types, variables, forms,
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
Fall 2009ACS-1805 Ron McFadyen1 Chapter 2 Program Design & Implementation.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Interactive Programming MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project.
Fall 2008ACS-1805 Ron McFadyen1 Event-driven programming Chapter 5 covers event-driven programming. Events are user or condition driven and so each event.
CompSci 4 Chap 5 Sec 1 and 2 Oct 14, 2010 Prof. Susan Rodger.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
Windows 7 Ultimate
Starting Out with Alice: A Visual Introduction to Programming
Chapter Topics 15.1 Graphical User Interfaces
Event-driven programming
Use Case Analysis Chapter 5.
The Alice Interface.
Event Driven Programming
Interactive Programming
Alice terms Chapter 3.
Graphical User Interfaces in Java Event-driven programming
Chapter 15: GUI Applications & Event-Driven Programming
ICT Programming Lesson 5:
Instructor: Ron McFadyen 3D
Chapter 13: Handling Events
Ch 9 Lists In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing the same.
Interactive Programming
Presentation transcript:

Event-driven programming Chapter 5 covers event-driven programming. Events are user or condition driven and so each event defines a triggering event and an event-handler (a method) Fall 2009 ACS-1805 Ron McFadyen

Event-driven programming Documenting events in storyboards e.g. Flight simulator program in Chapter 5 Event trigger: spacebar pressed Event trigger: up arrow pressed Response: Roll biplane Response: Move biplane forward Alice programming: a method is executed when event occurs Fall 2009 ACS-1805 Ron McFadyen

Event-driven programming Think of the Alice system having a loop where it continually checks for the occurrence of an event. When an event occurs the Alice system invokes the event-handler defined for the event. Fall 2009 ACS-1805 Ron McFadyen

Event-driven programming With Alice we can define events in the upper right window: Fall 2009 ACS-1805 Ron McFadyen

Event-driven programming Next we’ll examine the examples of the text: Air-show flight simulator Saving people Greek tragedy Fall 2009 ACS-1805 Ron McFadyen