Design a news feed - Machine CodingSubhahu JainΒ·Jan 13, 2023Β·7 min readTable of contentsCodeIssues in Above Designπ₯ Problem 1: Observer Pattern = Notification Disasterβ What we Didβ Why This Is a Critical Design FlawSolutionπ₯ Problem 2: NewsFeed Is a God Objectβ What we Didβ Why This Is DangerousSolutionπ₯ Problem 3: Feed Retrieval Is O(N) and Unscalableβ What we Didβ Why This Will Never WorkSolutionπ₯ Problem 4: No Personalization Model at Allβ Whatβs MissingSolutionπ₯ Problem 5: Concurrency Is Completely Ignoredβ What we Didβ Why This Is FatalSolutionπ₯ Problem 6: Topics Are the Wrong Abstraction for Feedsβ What we Modeledβ Why This Is NaiveSolutionπ₯ Problem 7: Decorator Pattern Misused for Core Dataβ What we Didβ Why This Is WrongSolutionπ₯ Problem 8: Time-Based Queries Are Naiveβ What we Didβ Why This FailsSolutionJavaScriptPythonGeneral ProgrammingProgramming BlogsJava