I Know What I Need, But I Don't Know How To Build It
Pick the thing you need. Then derive it: meaning, state, operations, rules, examples, representation, pseudocode — and only then the code, one rung at a time.
“I know I need a shopping cart. I have no idea how to implement a shopping cart.” The gap is not a missing tutorial; it is a missing method. Every stage below asks you to write before it shows you anything, because the code is the last step of a derivation, not the first thing to search for.
Which concept?
Grouped by exercise level; the level is how far the derivation goes, not how hard the code is.
How much help?
Every stage's content is shown right after your attempt box.
Notifications — twelve stages
I know I need notifications — "someone replied to you", "your order shipped". I have no idea how to implement notifications.
Define the concept
In one sentence, without any code: what is it? Then answer for yourself — does it have identity, who owns it, how long does it exist, should it survive a reload or a login?
Notifications = A message addressed to one recipient about something that happened, which the recipient has or has not yet seen.
- Does a notification have identity? Yes. Two "your order shipped" messages for two orders are two notifications, and marking one read must not mark the other. It needs an id from the first version, because mark-read has to name one.
- Who owns it? The recipient. The event that caused it (a reply, a shipment) belongs to another part of the system; the notification is the recipient's copy of the news. A notification that could be read by two people is two notifications.
- How long does it exist? From the moment the event is turned into a message until the recipient dismisses it or a retention rule expires it. Whether an old read notification stays in history is a product decision, not a property of the concept.
- Should it survive reload? Yes, almost always — the whole point is to be there when the user comes back. That means the store is on the server from V2 on; an in-memory list is only V1.
- Should it survive login? It is keyed by the recipient, so logging in from another device shows the same unread list. Anonymous users have no recipient and therefore no notifications; that is a rule, not a gap.
The catalog is one derivation, not the only one (impl §60). A different set of examples yields different rules; a different first requirement yields a different V1; a map instead of an array is not wrong, only an answer to a different question. Compare your derivation with the reference for the differences, then decide which ones were rules and which were style.
Take it further
The flagship exercise: the cart typed by you, with the reference hidden until you ask.
Make It Smaller Until You Know How to Build It →The principle behind the ladder, and the primitive chain it produces.
The Implementation Loop →The loop the twelve stages follow, and why the code is last.