Reading 17: Callbacks and Graphical User Interfaces
In this reading we talk about callbacks, in which an implementer calls a function provided by the client. We discuss this idea in the context of graphical user interfaces (GUIs), where a kind of callback function called a listener is used to respond to incoming input events from the user. We briefly saw callbacks when discussing asynchronous computation in a previous reading, and we’ll see more instances of callbacks in future classes, when we talk about web servers. A callback is a function that a client provides to a module for the module to call. This is in contrast to normal control flow, in which the client is doing all the calling: calling down into functions that the module provides. With a callback, the client is providing a piece of code for the implementer to call. We already saw one kind of callback in Functional Programming: the function passed to map or filter or reduce, which is called repeatedly for each element of the sequence. This is a synchronous callback, because it
Reading 17: Callbacks and Graphical User Interfaces Reading 17: Callbacks and Graphical User Interfaces Software in 6.102 Safe from bugs Easy to understand Ready for change Correct today and correct in the unknown future. Communicating clearly with future programmers, including future you. Designed to accommodate change without rewriting. Objectives In this reading we talk about callbacks , in which an implementer calls a function provided by the client. We discuss this idea in the context of graphical user interfaces (GUIs), where a kind of callback function called a listener is used to respo
saved by
related reading
- Reading 13: Map, Filter, Reduceweb.mit.edu
- Reading 15: Promisesweb.mit.edu
- Reading 4: Specificationsweb.mit.edu
- Reading 11: Recursive Data Typesweb.mit.edu
- Reading 18: Message-Passing and Networkingweb.mit.edu
- Reading 19: Little Languagesweb.mit.edu
- Reading 14: Concurrencyweb.mit.edu
- Reading 16: Mutual Exclusionweb.mit.edu
- What the heck is the event loop anyway? | Philip Roberts | JSConf EUyoutube.com
- The Event Loop and Callback Hell - Wes Boswesbos.com
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- Pure UIrauchg.com