Lesson plan
Callback (computer programming)
In computer programming, a callback is a programming pattern in which a function reference is passed from one context (consumer) to another (provider) such that the provider can call the function. If the function accesses state or functionality of the consumer, then the call is back to the consumer – backwards compared to the normal flow of control in which a consumer calls a provider. A function that accepts a callback parameter may be designed to call back before returning to its caller. But, more typically, a callback reference is stored by the provider so that it can call the function later (as deferred). If the provider invokes the callback on the same thread as the consumer, then the call is blocking, a.k.a. synchronous. If instead, the provider invokes the callback on a different thread, then the call is non-blocking, a.k.a. asynchronous. A callback can be likened to leaving instructions with a tailor for what to do when a suit is ready, such as calling a specific phone number or delivering it to a given address. These instructions represent a callback: a function provided in advance to be executed later, often by a different part of the system and not necessarily by the one that received it. The difference between a general function reference and a callback can be subtle, and some use the terms interchangeably but distinction generally depends on programming intent.…
Article summary
In computer programming, a callback is a programming pattern in which a function reference is passed from one context (consumer) to another (provider) such that the provider can call the function. If the function accesses state or functionality of the consumer, then the call is back to the consumer – backwards compared to the normal flow of control in which a consumer calls a provider. A function that accepts a callback parameter may be designed to call back before returning to its caller. But, more typically, a callback reference is stored by the provider so that it can call the function later (as deferred). If the provider invokes the callback on the same thread as the consumer, then the call is blocking, a.k.a. synchronous. If instead, the provider invokes the callback on a different thread, then the call is non-blocking, a.k.a. asynchronous. A callback can be likened to leaving instructions with a tailor for what to do when a suit is ready, such as calling a specific phone number or delivering it to a given address. These instructions represent a callback: a function provided in advance to be executed later, often by a different part of the system and not necessarily by the one that received it. The difference between a general function reference and a callback can be subtle, and some use the terms interchangeably but distinction generally depends on programming intent.…
Key claims
No claims recorded.
Discussion questions
- Summarise the article in your own words. Which single claim would you verify first, and why?
- Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
- If two sources disagreed about one of these facts, what would you need in order to trust one over the other?
Bibliography
No sources recorded.
Key claims and bibliography are generated from the same tracked claims and sources as the article page.