Callbacks and Async Event-Based Programming

Core Concepts

  • What are asynchronous events
  • How to respond to them with callbacks
  • How to apply in Java and Android

What are asynchronous events

Synchronous vs. Asynchronous

Synchronous

  • Work executes sequentially, including time-consuming tasks.
  • Attention must stay focused at the task at hand.
  • Less efficient overall.

Asynchronous

  • Work can be performed in parallel.
  • Attention can be freed up to perform other tasks.
  • More efficient overall.

Same Paradigm

  • We have similar paradigms in mobile devices.

    • A mouse click on a button can occur at any point in the future.

    • A request to fetch data from a web site will be issued but might not respond immediately.

Made with Slides.com