UP | HOME
2017-02-10 | ../../ | Slides

Event Driven Programming

1 Abstract

Event Driven Programming. Fundamentals. JavaFX implementations.

2 Event Driven Prog

2.1 What is an event?

  1. Def is too complicated. Ex: a key-press, a key-release, mouse gesture, a file changing from read-only to write-also, CPU becoming 95% loaded, disk being 75% vacant, …
  2. An event is modeled as an instantaneous occurrence. A real event that has a duration is modeled as event-begin and even-end – ex: key board key-press and then key-release.
  3. The discovery of events is the responsibility of the "underlying" system.

2.2 Overview

  1. Event details: source, time stamp,
  2. Event Driven Prog is an important paradigm. Independent of PLs.
  3. A main loop over a table of (event –> action) pairs.
  4. Classifying events, and pairing them up with actions is the even driven paradigm.
  5. https://en.wikipedia.org/wiki/Event-driven_programming

2.3 Actions and Listeners

  1. Action is often collaborative among several event handlers listening to the event.
  2. The (event –> action) becomes (event e –> send-to-listeners(e))

2.4 Complications

  1. What is the time gap tg between an event happening, and the begin of an action?
  2. In this tg can more events happen?
  3. Can events happen concurrently?
  4. Can we listen to events happening in remote systems?
  5. Can actions be executed concurrently?

2.5 JavaFX

  1. Java8 + JavaFX actions are typically written as Lambda Expressions.
  2. ../Java8/JavaFX-EventDrivenProgramming-stonybrook.pdf Event-Driven Programming in JavaFX, slides, SUNY Stonybrook 2015; includes src code of examples
    1. Explains Anonymous Classes
    2. Explains Inner Classes
    3. Explains Lambda Expressions
  3. http://gluonhq.com/labs/javafxports/ JavaFX on Mobile (Android + iOS). Open Source.

2.6 Agents

  1. Meyers book, Chapter 18: PDF high-level intro to Event-driven design, slides, not JavaFX.

3 GoL

  1. Game-Of-Life, Redo updated to include event-driven

4 References

  1. https://www.cs.rit.edu/~csci242/Lectures/14/Event-diagrams.pdf Java GUIs in JavaFX. 2015. Recommended Reading.

5 End


Copyright © 2017 www.wright.edu/~pmateti 2017-02-10