Just-in-Time Context
In this article
- Sort each item a request could carry into always-loaded, just-in-time or excluded, and give the reason.
- Say what triggers a load and who triggers it, and record with each loaded item where it came from and when.
- Decide when a loaded copy must be loaded again before a step, and when it can leave the request as a pointer.
- Write the fallback for a load that fails, so the reply says so instead of guessing.
- Terms defined here: just-in-time context.
Overview
To be safe, the application behind a support chat loads everything that might matter when the session opens: the customer's order record and a batch of help pages. Half an hour later the customer writes that the parcel arrived with a crushed box, and the assistant replies that it is still on its way. Nothing was wrong at load time. The order system changed the status to delivered afterwards, and every request since has carried the copy from the start of the session.
Brightline is an invented home-internet provider; its pages, times and sizes below are made up too. Its support assistant is a chat assistant on Brightline's website that can look up an order, issue a refund up to an approved limit and search help pages, with the tools lookup_order, issue_refund and search_help.
Loading everything up front fails twice: copies age while the session runs, and the request carries material for steps that never come. The fix is to decide, item by item, when each piece of context enters the request, how long it stays, and what happens when it cannot be had.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- Three classes of item
- Loading at the step that needs it
- Refresh before acting
- Eviction, reload and fallback
- One policy per item
- Common mistakes
- Sources
- Check yourself, 5 questions