Textbook Notes (280,000)
US (110,000)
BU (1,000)
CAS CS (6)
Chapter 6

CAS CS 101 Chapter Notes - Chapter 6: Usability, Space Bar


Department
Computer Science
Course Code
CAS CS 101
Professor
Aaron Stevens
Chapter
6

This preview shows half of the first page. to view the full 2 pages of the document.
Chapter 6 Alice In Action Notes – Events
There are 2 steps to making a program respond when an event occurs:
1. Choose (or define) a method providing the behavior to occur in response to the
event
2. Tell Alice to invoke that method whenever the event occurs
handling the event - Invoking a method in response to an event
event handler - a method that is invoked in response to an event is often called
an event handler
event-driven program - A program that solves a problem or tells a story mainly
through events and handlers
If an event should trigger behavior that requires more than one message, we
define a method that produces that behavior. (this method is the handler)
create a new event in the events area that invokes the handler - either the
method we defined or a single message will produce the proper behavior for the
event
event source - object from which an event originates
logic errors - the mistakes in the logic used in defining an event
Event handling is simultaneous - one thing could happen before another thing
finishes
usually works well, but if they are modifying the same property of an object
conflicts can rise
mouse event - event that is triggered when the user moves the mouse or clicks
a mouse button
keyboard event - is triggered when the user presses a keyboard key
user events - events initiated by a user action
program event - triggered when the world starts running, or the program
changes the value of a variable or condition
Mnemonic Values - ‘a’ is the first letter of ‘ascend’ and ‘d’ is the first letter of
‘descend’, these are easy to remember | the arrows point in the direction the
object would go
Convenient Positions - ‘a’ and ‘d’ are near one another on most keyboards =
easy to control, the 4 arrow keys are grouped together
important to consider human factors when building interactive stories
Usability - making programs easy to use
Using “when a key is pressed/typed event”:
contains three different handlers:
1. Begin - a handler here is performed once, when the key is first pressed
2. During - a handler here is performed continuously, as long as the key remains
down
3. End - a handler here is performed once, when the key is released
3D Text
You're Reading a Preview

Unlock to view full version