State Discovery Tool

What must it remember? Tick the fields you think belong; Atlas challenges the ones that can be derived, dropped, or that depend on the version — and says what each choice costs.

I need XWhat is X?What must it remember?What can happen to it?What must always hold?ExamplesRepresent the stateWhich structure?Each operationPseudocodeImplement oneTest with examplesEdge casesIntegrate

The reflex is to store everything the screen shows. The discipline is to store only what no operation can compute — the product name is in the catalog, the total is a loop over the items, the timestamp has no reader yet. Every field you keep is a second source of truth you now have to keep in sync.

Which concept?

beginner
intermediate
advanced

Shopping Cart — what must it remember?

A temporary collection of products the user intends to purchase, held between browsing and checkout.

Concept — what must it remember? Select every field you would store.
0 of 9 selected

The verdicts

Nothing shown until you check — the tick is the attempt.

Pick the fields first. Then the reference shows, for each one, the challenge it survived or failed and the trade-off behind the verdict.

Identity, ownership, lifetime

The questions that decide whether a field is state at all.

  • Does a cart have identity? Yes, weakly. Two carts with the same items are still two carts, because each belongs to someone and will become a different order. It needs an id once it leaves memory; in memory the variable is the identity.
  • Who owns it? A shopper — a logged-in user or an anonymous session. The owner is part of the state because "my cart" has to be findable again.
  • How long does it exist? From the first add until checkout or abandonment. Whether it survives a reload, a closed browser or a login is not a property of the concept; it is a persistence decision made later, and each answer changes where the cart lives.
  • Should it survive reload? Usually yes for a store, usually no for a demo. V1 in memory says no; V2 browser storage says yes on one device; V3 server storage says yes everywhere the user is logged in.
  • Should it survive login? Only if an anonymous cart and a logged-in cart are merged — a rule that does not exist in V1 and appears as a modification later.
SIMPLIFIED

The verdicts are the catalog's derivation for one V1 — an in-memory cart with one shopper and one currency. A different first requirement changes them: a multi-currency store keeps `currency`, an abandonment report keeps `createdAt`. The challenge is what transfers, not the verdict.