SlideShare a Scribd company logo
Event-driven programming
Most modern computer
programs that people
use have Graphical
User Interfaces (GUIs).
A GUI has icons on the
computer screen and a
mouse (or other device)
to control a pointer that
can be used to operate
the computer.
Event-Driven Programming
Event-Driven Programming
An Introduction to Programming Using Alice
Most modern computer
programs that people
use have Graphical
User Interfaces (GUIs).
A GUI has icons on the
computer screen and a
mouse (or other device)
to control a pointer that
can be used to operate
the computer.
This slide is an image of Microsoft Word
2007. It is an example of a modern
graphical user interface.
Modern GUIs like the Word 2007 interface require
the use of event-driven programming.
An event occurs whenever an event listener
detects an event trigger and responds by running
a method called an event handler.
An event occurs whenever an event listener
detects an event trigger and responds by running
a method called an event handler.
An event occurs whenever an event listener
detects an event trigger and responds by running
a method called an event handler.
Modern operating systems and programming
languages contain facilities to let programmers set
up event listeners.
An event trigger can be almost any activity or
condition selected by the programmer, such as a
mouse movement, someone pressing the enter
key, or a bank account balance changing.
An event handler is a method that is activated
when the event trigger occurs.
Almost any method can serve as an event handler,
such as those that play sounds, initiate data
communications, or perform calculations.
In Alice…
• Events can be used to control objects
moving in 3D space.
– Detect when some object moves
– Detect when two objects collide
– Make objects move in response to mouse or
keyboard commands.
• So before discussing events in Alice, let’s
talk about 3D space a little more.
3D space
• A dimension is a way of measuring
something.
• We create a dimension whenever we
assign a value on a continuous scale to
some property.
• Example: On a scale of 1 to 100, how
much do you approve of George Bush’s
performance as president?
Measuring distance
• If you wish to measure the location of a point on
a straight line, then you only need one number.
• You could mark a start point on the line, and
then measure how far a point is from the start
point
• By using negative and positive numbers, you
could also indicate which direction the distance
spans.
Orientation
• In addition, to the concepts of distance and
direction, we also have the concept of
orientation.
• Orientation means the direction the object is
facing.
• If an object is facing the positive direction on the
line, its orientation is forward.
• If facing negative, then backward.
Point of view
• Location and orientation together are
known as the point of view of an object.
Two ideas of direction
• Absolute vs. object-relative.
• Absolute direction of boy on bike I backward, but
forward in relation to Alice
Object-relative positions
• From the coach’s point of view, Alice is behind
the boy, while the coach is in front of the boy.
Position in 2D
• On a flat surface, like a sheet of paper, you need
two values to specify an object’s position (two
dimensions).
• Rene Descarte developed a system of
quantification for two dimensions.
• This is called Cartesian coordinates.
• Cartesian coordinates have an X axis
(dimension) and Y axis.
• The coordinates of a point are always specified
as x,y.
A third dimension
• Moving up and down off a flat plane
requires a third axis or dimension.
• Instead of an ordered pair to represent
position, we need an ordered triplet (x,y,z).
• In Alice the z axis provides a
measurement of depth.
• 3D space is sometimes called Euclidean
3-space after the Greek mathematician,
Euclid.
Absolute vs. Object-relative
• For all objects we must be aware of
absolute position and direction
• However, we are most commonly
concerned with object-relative position and
direction.
More on object-relativity
• We must also frequently consider the
movement of objects from the perspective
of other objects.
• See SharkAsSeenByExample.a2w
Events in Alice
Events in Alice
Alice events are created in the events area of the
standard Alice interface.
events area
Events in Alice
Alice events are created in the events area of the
standard Alice interface.
events area
Events in Alice
An Alice event tile specifies the event trigger
and the event handler.
In this example, the event trigger is the spacebar,
being pressed and the event handler is the
iceSkater’s simpleSpin method.
Events in Alice
create new event button
The create new event button will reveal a menu
with nine different event types.
Events in Alice
The create new event button will reveal a menu
with nine different event types.
Events in Alice
A programmer can pick the event type that has the
desired event trigger.
Events in Alice
Some event
types also have
built-in event
handlers…
A programmer can pick the event type that has the
desired event trigger.
Events in Alice
Some event
types also have
built-in event
handlers…
In other cases,
programmers
must specify
the handler.
A programmer can pick the event type that has the
desired event trigger.
Event handlers are specified by
dragging method tiles from the
details area and dropping them
into the event tile.
Exploring Events
• Start Alice and open the amusementPark
example world.
• In the events area, you should see seven
event tiles.
Amusement Park Events
Event-Driven Programming
• Events are an important part of Alice
programming, allowing the creation of interactive
worlds with keyboard and mouse user controls.
• Most modern programming languages allow
programmers to add events to new software.
• Events can be used for many other purposes,
such as controlling burglar alarms, checking
remote sensors, or checking for system events,
like printers running out of paper.
• Events are an important part of modern
computer programming.

More Related Content

Similar to 03a-IntroductionToEventDrivenProgramming.ppt

Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technology
Vinay Sagar Bhat
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
usvirat1805
 
GRADE 5 TINKERCAD powepoint presentation
GRADE 5 TINKERCAD powepoint presentationGRADE 5 TINKERCAD powepoint presentation
GRADE 5 TINKERCAD powepoint presentation
AllanGuevarra1
 
Unit 2 - Complete (1).pptx
Unit 2 - Complete (1).pptxUnit 2 - Complete (1).pptx
Unit 2 - Complete (1).pptx
gogulram2
 
Application of Calculus in Computer Science.pptx
Application of Calculus in Computer Science.pptxApplication of Calculus in Computer Science.pptx
Application of Calculus in Computer Science.pptx
Mehedi Hasan
 
Mobile Toolbox for Middle Years Maths
Mobile Toolbox for Middle Years MathsMobile Toolbox for Middle Years Maths
Mobile Toolbox for Middle Years Maths
Hawkesdale P12 College
 
Programming-In-Alice.pptx
Programming-In-Alice.pptxProgramming-In-Alice.pptx
Programming-In-Alice.pptx
Carlos134964
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
Gangeshwar Krishnamurthy
 
Digital illustration handbook
Digital illustration handbookDigital illustration handbook
Digital illustration handbook
MrLawler
 
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTIONA SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
ijcsit
 
SIXTH SENSE TECHNOLOGY
SIXTH SENSE TECHNOLOGYSIXTH SENSE TECHNOLOGY
SIXTH SENSE TECHNOLOGY
Sankari Eshwari
 
Hands and Speech in Space: Multimodal Input for Augmented Reality
Hands and Speech in Space: Multimodal Input for Augmented Reality Hands and Speech in Space: Multimodal Input for Augmented Reality
Hands and Speech in Space: Multimodal Input for Augmented Reality
Mark Billinghurst
 
Mar general pan hui ppt
Mar general pan hui ppt Mar general pan hui ppt
Mar general pan hui ppt
luruiyang
 
Use Of Bearings And Its Impact On Society
Use Of Bearings And Its Impact On SocietyUse Of Bearings And Its Impact On Society
Use Of Bearings And Its Impact On Society
Jennifer Perry
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODS
SanthiNivas
 
3.3 - The Math Object.pptx
3.3 - The Math Object.pptx3.3 - The Math Object.pptx
3.3 - The Math Object.pptx
MaryhesterDeleon
 
01. Introduction.pptx
01. Introduction.pptx01. Introduction.pptx
01. Introduction.pptx
LUISRICARDODIAZMONTE
 
Alice05
Alice05Alice05
Alice05
h2vs10
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people mattered
Aryan Rathore
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
Minakshi Atre
 

Similar to 03a-IntroductionToEventDrivenProgramming.ppt (20)

Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technology
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
 
GRADE 5 TINKERCAD powepoint presentation
GRADE 5 TINKERCAD powepoint presentationGRADE 5 TINKERCAD powepoint presentation
GRADE 5 TINKERCAD powepoint presentation
 
Unit 2 - Complete (1).pptx
Unit 2 - Complete (1).pptxUnit 2 - Complete (1).pptx
Unit 2 - Complete (1).pptx
 
Application of Calculus in Computer Science.pptx
Application of Calculus in Computer Science.pptxApplication of Calculus in Computer Science.pptx
Application of Calculus in Computer Science.pptx
 
Mobile Toolbox for Middle Years Maths
Mobile Toolbox for Middle Years MathsMobile Toolbox for Middle Years Maths
Mobile Toolbox for Middle Years Maths
 
Programming-In-Alice.pptx
Programming-In-Alice.pptxProgramming-In-Alice.pptx
Programming-In-Alice.pptx
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Digital illustration handbook
Digital illustration handbookDigital illustration handbook
Digital illustration handbook
 
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTIONA SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
A SOFTWARE TOOL FOR EXPERIMENTAL STUDY LEAP MOTION
 
SIXTH SENSE TECHNOLOGY
SIXTH SENSE TECHNOLOGYSIXTH SENSE TECHNOLOGY
SIXTH SENSE TECHNOLOGY
 
Hands and Speech in Space: Multimodal Input for Augmented Reality
Hands and Speech in Space: Multimodal Input for Augmented Reality Hands and Speech in Space: Multimodal Input for Augmented Reality
Hands and Speech in Space: Multimodal Input for Augmented Reality
 
Mar general pan hui ppt
Mar general pan hui ppt Mar general pan hui ppt
Mar general pan hui ppt
 
Use Of Bearings And Its Impact On Society
Use Of Bearings And Its Impact On SocietyUse Of Bearings And Its Impact On Society
Use Of Bearings And Its Impact On Society
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODS
 
3.3 - The Math Object.pptx
3.3 - The Math Object.pptx3.3 - The Math Object.pptx
3.3 - The Math Object.pptx
 
01. Introduction.pptx
01. Introduction.pptx01. Introduction.pptx
01. Introduction.pptx
 
Alice05
Alice05Alice05
Alice05
 
Designing agents as if people mattered
Designing agents as if people matteredDesigning agents as if people mattered
Designing agents as if people mattered
 
Popular search algorithms
Popular search algorithmsPopular search algorithms
Popular search algorithms
 

More from tadudemise

What is requirement gathering chap3 1.pptx
What is requirement gathering chap3 1.pptxWhat is requirement gathering chap3 1.pptx
What is requirement gathering chap3 1.pptx
tadudemise
 
chaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
chaptertaaaaaaaaaaaaaaadddddddd2222 4.pptchaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
chaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
tadudemise
 
8329969.ppt
8329969.ppt8329969.ppt
8329969.ppt
tadudemise
 
Introduction.ppt
Introduction.pptIntroduction.ppt
Introduction.ppt
tadudemise
 
Chapter 1.ppt
Chapter 1.pptChapter 1.ppt
Chapter 1.ppt
tadudemise
 
SPL_PS2 (1).ppt
SPL_PS2 (1).pptSPL_PS2 (1).ppt
SPL_PS2 (1).ppt
tadudemise
 
cse581_03_EventProgramming.ppt
cse581_03_EventProgramming.pptcse581_03_EventProgramming.ppt
cse581_03_EventProgramming.ppt
tadudemise
 
03a-IntroductionToEventDrivenProgramming.ppt
03a-IntroductionToEventDrivenProgramming.ppt03a-IntroductionToEventDrivenProgramming.ppt
03a-IntroductionToEventDrivenProgramming.ppt
tadudemise
 

More from tadudemise (8)

What is requirement gathering chap3 1.pptx
What is requirement gathering chap3 1.pptxWhat is requirement gathering chap3 1.pptx
What is requirement gathering chap3 1.pptx
 
chaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
chaptertaaaaaaaaaaaaaaadddddddd2222 4.pptchaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
chaptertaaaaaaaaaaaaaaadddddddd2222 4.ppt
 
8329969.ppt
8329969.ppt8329969.ppt
8329969.ppt
 
Introduction.ppt
Introduction.pptIntroduction.ppt
Introduction.ppt
 
Chapter 1.ppt
Chapter 1.pptChapter 1.ppt
Chapter 1.ppt
 
SPL_PS2 (1).ppt
SPL_PS2 (1).pptSPL_PS2 (1).ppt
SPL_PS2 (1).ppt
 
cse581_03_EventProgramming.ppt
cse581_03_EventProgramming.pptcse581_03_EventProgramming.ppt
cse581_03_EventProgramming.ppt
 
03a-IntroductionToEventDrivenProgramming.ppt
03a-IntroductionToEventDrivenProgramming.ppt03a-IntroductionToEventDrivenProgramming.ppt
03a-IntroductionToEventDrivenProgramming.ppt
 

Recently uploaded

Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 

Recently uploaded (20)

Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 

03a-IntroductionToEventDrivenProgramming.ppt

  • 2. Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen and a mouse (or other device) to control a pointer that can be used to operate the computer. Event-Driven Programming
  • 3. Event-Driven Programming An Introduction to Programming Using Alice Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen and a mouse (or other device) to control a pointer that can be used to operate the computer.
  • 4. This slide is an image of Microsoft Word 2007. It is an example of a modern graphical user interface.
  • 5. Modern GUIs like the Word 2007 interface require the use of event-driven programming. An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler.
  • 6. An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler.
  • 7. An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler. Modern operating systems and programming languages contain facilities to let programmers set up event listeners.
  • 8. An event trigger can be almost any activity or condition selected by the programmer, such as a mouse movement, someone pressing the enter key, or a bank account balance changing.
  • 9. An event handler is a method that is activated when the event trigger occurs. Almost any method can serve as an event handler, such as those that play sounds, initiate data communications, or perform calculations.
  • 10. In Alice… • Events can be used to control objects moving in 3D space. – Detect when some object moves – Detect when two objects collide – Make objects move in response to mouse or keyboard commands. • So before discussing events in Alice, let’s talk about 3D space a little more.
  • 11. 3D space • A dimension is a way of measuring something. • We create a dimension whenever we assign a value on a continuous scale to some property. • Example: On a scale of 1 to 100, how much do you approve of George Bush’s performance as president?
  • 12. Measuring distance • If you wish to measure the location of a point on a straight line, then you only need one number. • You could mark a start point on the line, and then measure how far a point is from the start point • By using negative and positive numbers, you could also indicate which direction the distance spans.
  • 13. Orientation • In addition, to the concepts of distance and direction, we also have the concept of orientation. • Orientation means the direction the object is facing. • If an object is facing the positive direction on the line, its orientation is forward. • If facing negative, then backward.
  • 14. Point of view • Location and orientation together are known as the point of view of an object.
  • 15. Two ideas of direction • Absolute vs. object-relative. • Absolute direction of boy on bike I backward, but forward in relation to Alice
  • 16. Object-relative positions • From the coach’s point of view, Alice is behind the boy, while the coach is in front of the boy.
  • 17. Position in 2D • On a flat surface, like a sheet of paper, you need two values to specify an object’s position (two dimensions). • Rene Descarte developed a system of quantification for two dimensions. • This is called Cartesian coordinates. • Cartesian coordinates have an X axis (dimension) and Y axis. • The coordinates of a point are always specified as x,y.
  • 18.
  • 19. A third dimension • Moving up and down off a flat plane requires a third axis or dimension. • Instead of an ordered pair to represent position, we need an ordered triplet (x,y,z). • In Alice the z axis provides a measurement of depth. • 3D space is sometimes called Euclidean 3-space after the Greek mathematician, Euclid.
  • 20.
  • 21. Absolute vs. Object-relative • For all objects we must be aware of absolute position and direction • However, we are most commonly concerned with object-relative position and direction.
  • 22.
  • 23. More on object-relativity • We must also frequently consider the movement of objects from the perspective of other objects. • See SharkAsSeenByExample.a2w
  • 25. Events in Alice Alice events are created in the events area of the standard Alice interface. events area
  • 26. Events in Alice Alice events are created in the events area of the standard Alice interface. events area
  • 27. Events in Alice An Alice event tile specifies the event trigger and the event handler. In this example, the event trigger is the spacebar, being pressed and the event handler is the iceSkater’s simpleSpin method.
  • 28. Events in Alice create new event button The create new event button will reveal a menu with nine different event types.
  • 29. Events in Alice The create new event button will reveal a menu with nine different event types.
  • 30. Events in Alice A programmer can pick the event type that has the desired event trigger.
  • 31. Events in Alice Some event types also have built-in event handlers… A programmer can pick the event type that has the desired event trigger.
  • 32. Events in Alice Some event types also have built-in event handlers… In other cases, programmers must specify the handler. A programmer can pick the event type that has the desired event trigger.
  • 33. Event handlers are specified by dragging method tiles from the details area and dropping them into the event tile.
  • 34. Exploring Events • Start Alice and open the amusementPark example world. • In the events area, you should see seven event tiles.
  • 36. Event-Driven Programming • Events are an important part of Alice programming, allowing the creation of interactive worlds with keyboard and mouse user controls. • Most modern programming languages allow programmers to add events to new software. • Events can be used for many other purposes, such as controlling burglar alarms, checking remote sensors, or checking for system events, like printers running out of paper. • Events are an important part of modern computer programming.