Design (LLD) Twitter - Machine CodingSubhahu JainΒ·Dec 31, 2022Β·7 min readTable of contentsCodeIssues in above designπ₯ Problem 1: Everything Is in HashMaps (Concurrency Nightmare)β What we Didβ Why This Is DangerousSolutionπ₯ Problem 2: Tweet Creation Is a Giant God Methodβ What we Didβ Why This Is a Design SmellSolutionπ₯ Problem 3: Timeline Generation Is Not Designed at Allβ Whatβs MissingSolutionπ₯ Problem 4: Notification System Is Synchronous and Blockingβ What we Didβ Why This Is DangerousSolutionπ₯ Problem 5: RateLimiter Is Not Thread-Safe (and Incorrect)β What we Didβ Why This FailsSolutionπ₯ Problem 6: CacheService Is Incorrect by Designβ What we Didβ Why This Breaks RealitySolutionπ₯ Problem 7: No Data Ownership or Aggregate Boundariesβ Big Missing ConceptSolutionJavaScriptPythonJavaGeneral ProgrammingProgramming Blogs