Sequential vs. Event-Driven Programming

1845 words 8 pages
Sequential vs. Event-driven Programming
Reacting to the user

Outline
Sequential programming GUI program organization Event-driven programming Modes

Sequential Programming
In sequential programs, the program is under control The user must synchronize with the program:
Program tells user it is ready for input User enters input and it is processed

Examples:
Command-line prompts (DOS, UNIX) LISP interpreters

Shouldn’t the program be required to synchronize with the user?

Sequential Programming (2)
Flow of a typical sequential program
Prompt the user Read input from the keyboard Parse the input (determine user action) Evaluate the result Generate output Repeat

Example
DemoTranslateEnglishConsole.java

Prompt the user User input Output
…show more content…
In our example, we used this as the “specified key listener” Indeed, the current instance of our extended JFrame class (“this”) is a key listener because it implements the key listener methods Result: when a key pressed event occurs on the enterArea component, the keyPressed method in our extended JFrame class will execute!

Let’s Say That Again…
When a key pressed event occurs on the enterArea component, the keyPressed method in our extended JFrame class will execute!

Processing Events
Signature for the keyPressed method: public void

Related

  • Cs Programming Chapter 1
    2464 words | 10 pages
  • Planning a Successful Event
    2504 words | 11 pages
  • History of the Event Industry
    2679 words | 11 pages
  • Remembered Event Narrative
    1135 words | 5 pages
  • Total Quality Management of an Event
    2099 words | 9 pages
  • Investment Strategy Linear Programming
    1407 words | 6 pages
  • American Revolution, Market Driven or Not
    904 words | 4 pages
  • The Importance of Event Planning
    1391 words | 6 pages
  • Great Expectations: A Character-Driven Novel
    1313 words | 6 pages
  • Importance of Teamwork in Events Industry
    1115 words | 5 pages