Programming terminology: events

A previous note introduced programming terms related to the objects in program user interfaces. This one presents terms for discussing the things a program does. These terms are illustrated by this simple message output program.

Running the program, we see that it can detect and respond to six events:

  1. The user clicks on the button that says "Cute"
  2. The user clicks on the button that says "Pretty"
  3. The user clicks on the button that says "Ugly"
  4. The user clicks on the button that says "Nice"
  5. The user clicks on the button that says "Handsome"
  6. The user clicks on the button that says "Clear"
When the user clicks on the first button, the computer has been programmed to say he or she is cute. When the user clicks on the second button, the computer has been programmed to say he or she is pretty. And so forth.

When the user clicks on the sixth button, the computer has been programmed to clear the TextBox.

We have just given an external description of this program -- we described what it does when someone uses it. Our external description was written in English.

We could also have written it more precisely in Geek. For example, we could say:

The value "You are cute." is assigned to the text property of the textbox when the user clicks on the button that has "Cute" as the value of its text property.

The event is the user clicking on the button and the event handler assigns the new value to the text property of the textbox.

A programmer wrote the instructions telling the computer what it should do when each of these events occurs. Those sub programs are called event handlers. While event handlers may be described in English or Geek, they must be written in Visual Basic or some other programming language if the computer is to understand and execute them.

The event handlers in this example are very simple. The computer does very little when an event occurs. This is meant to be a simple teaching example, but in real programs, the event handlers can be complex sub-programs that do a lot of work. For example, when the user changes the value of a cell in a spreadsheet (an event) the event handler re-calculates and displays the entire spreadsheet.

Finally, our program handles only six events. The computer was not programmed to do anything when, for example, the user just moves the mouse over a button without clicking on it or clicks on a label. We are only concerned with events the computer has been programmed to detect and act upon.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.