Section 2: A Late Post Is Fine, a Leaked Post Is Not - Requirements (Functional & Non-Functional)
Executive Summary: This section turns Section 1's answers into a contract. Seven functional requirements cover posting, following and reading a ranked feed, including two that candidates often skip: honoring privacy and blocks, and letting authors see their own posts at once. Six features are ruled out, each with a reason. The non-functional requirements put numbers on latency (200 ms to open the feed), freshness (5 s), availability (99.99% for reads) and durability. One asymmetry carries the section: freshness can lag by seconds, but a stale feed entry must never get past the visibility check. We finish by showing that these requirements already settle four big design choices before we've done any arithmetic.
The clarifications are done. The interviewer caps the marker: "OK. What exactly are you committing to?" "The feed should be fast and fresh" isn't a commitment. "Maya's first page returns in 200 ms at p99" is. So every requirement you write has to be something a test could check.
The Functional Contract
Seven requirements, written as things a user can do or see.
| # | Requirement | Notes |
|---|---|---|
| FR1 | Publish a post: 1–10 photos or one short video, plus a caption | Media is uploaded first. The post is created only after the upload completes |
| FR2 | Delete your own post | It disappears from every feed on the next fetch |
| FR3 | Follow and unfollow an account | Following a private account needs the owner's approval |
| FR4 | Read the home feed: ranked, 20 posts per page, infinite scroll | Only posts from accounts the viewer follows, for now |
| FR5 | Pull to refresh | Re-ranks and shows new posts without repeating what you just saw |
| FR6 | Honor private accounts and blocks | Strict. Checked on every page, never trusted to a feed cache or snapshot |
| FR7 | An author sees their own new post in their feed immediately | Even though everyone else may see it seconds later |
FR6 and FR7 are the two that get skipped. FR6 because it sounds like a policy detail, and FR7 because it seems too obvious to write down.
Interviewer: "Why is FR7 its own line? Dev's post shows up for everyone within a few seconds anyway."
You: "Because 'a few seconds' feels like a bug to the person who just posted. Dev posts his hike photo at 9:00:00, pulls to refresh at 9:00:01, and if his own photo isn't there he posts it again. Now we have a duplicate. His 300 active followers won't notice a 1-second delay. Dev will. So the system can be eventually consistent for everyone except the author, and the author gets read-your-own-writes."
Interviewer: "And FR4 says 'only accounts the viewer follows.' Real feeds have ads and suggested posts."
You: "They do, and I'll leave a slot for them. Today every candidate comes from the follow graph. Section 11 adds other candidate sources after ranking without changing anything upstream."
Quick check before moving on:
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson