Preview — Pro guide
You are seeing a portion of this guide. Sign in and upgrade to unlock the full article, quizzes, and interview answers.
Sections
Related Guides
Task & Job Scheduler — LLD (Cron, Queues, At-Least-Once, Idempotent Workers)
Low-Level Design
Design Patterns for LLD Interviews
Low-Level Design
SOLID Principles in Practice
Low-Level Design
Hotel Booking System — LLD Deep Dive
Low-Level Design
LLD Interview Framework & Walkthrough
Low-Level Design
Social Follow & Home Feed — LLD (Graph, Push vs Pull, Feed Strategies)
Object-oriented design for follow relationships, optional follow requests, blocking, and feed generation. Teaches how to model the social graph separate from posts, when to use Strategy for push-fanout vs pull-merge feeds, and what to leave to infrastructure without faking a single Map that scales to billions of edges.
What Interviewers Are Actually Testing
They are not asking you to rebuild Twitter at HLD scale in 40 minutes. They want: a clean graph model (User, FollowEdge with state, BlockEdge), a Feed abstraction that does not entangle storage of every post inside User, and the push vs pull tradeoff expressed as replaceable strategies, not buzzwords. Strong candidates say: push materializes fan-out at write time (inbox per user); pull merges at read from followed author lists — each is a class implementing FeedBuilder. Weak candidates return List<Post> from User.getFeed() with O(follows × posts) hidden in a getter and call it done.
Clarifying Questions
Directed follow (Twitter) vs symmetric friends (Facebook classic)?
FollowEdge is asymmetric; Friendship is two approval edges or one undirected record — model changes follow-up questions on privacy.
Follow requests vs instant follow?
Add PENDING state on edge; accept() transitions to ACTIVE. Private accounts — only approved followers see posts.
Block vs mute?
BlockEdge removes follow, hides both ways; mute is reader-only filter — separate type or flag on consumer side.
Global feed ordering — reverse chrono only?
Start with time; ranker is a separate FeedRanker strategy for 'For you' mix — do not implement a DNN in LLD, name the seam.
Scale hints?
If celebrity with 50M followers is in scope, fan-out write path is expensive — you either cap delivery, hybridize, or acknowledge HLD — the LLD still has the right interfaces.