Library / Blogs
Top 10 Common Large-Scale Software Architectural Patterns in a Nutshell
On the nature of the novel paradigm of programming
By Towardsdatascience engineers · Towardsdatascience · Added 2026-10-12
All content belongs to Towardsdatascience engineers / Towardsdatascience. We only link to it and give credit. Report a problem
Learn this article
About 37 min left. Your work is saved as you go.
What you are about to study
Towardsdatascience wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Software Design Essentials · 12 minThe SOLID principlesFive guidelines for classes and modules that are easy to understand, extend and test, with before-and-after examples.Read here
What SOLID is for
SOLID is a set of five guidelines (collected by Robert C. Martin) that help keep code easy to change. They fight three common problems:
- Rigidity: one change forces edits in many places.
- Fragility: a change breaks something unrelated.
- Immobility: you cannot reuse a part without dragging everything with it.
They are guidelines, not laws: apply them where they remove pain.
100%Figure SDA-SDE-02-1 · What SOLID is for · © forcsguy.com
S: Single Responsibility Principle
A module should have one reason to change.
Group code that changes for the same reason, and separate code that changes for different reasons.
// Before: three reasons to change (rules, formatting, storage) class Report { total(items: Item[]) { /* business rule */ } toHtml(items: Item[]) { /* presentation */ } save(items: Item[]) { /* database */ } } // After: each part changes independently class ReportCalculator { total(items: Item[]) { /* ... */ } } class ReportHtmlView { render(total: number) { /* ... */ } } class ReportRepository { save(items: Item[]) { /* ... */ } }O: Open/Closed Principle
Software should be open for extension, closed for modification.
Add behaviour by adding code, not by editing tested code. Typically use an abstraction and several implementations.
// Before: every new payment type edits this function function fee(method: string, amount: number) { if (method === "card") return amount * 0.03; if (method === "bank") return 0.5; return 0; } // After: add a new class; the caller never changes interface FeePolicy { fee(amount: number): number } class CardFee implements FeePolicy { fee(a: number) { return a * 0.03; } } class BankFee implements FeePolicy { fee(_a: number) { return 0.5; } } const total = (p: FeePolicy, amount: number) => amount + p.fee(amount);L: Liskov Substitution Principle
A subtype must be usable wherever its base type is expected, without surprises.
If code works with
Bird, it must still work when given any subclass. A classic violation:class Bird { fly() { /* ... */ } } class Penguin extends Bird { fly() { throw new Error("cannot fly"); } } // breaks callersThe fix is a better model: separate
BirdfromFlyingBird, or use composition. Signs of a violation: subclasses that throw for inherited methods, strengthen preconditions, or weaken guarantees.I: Interface Segregation Principle
Clients should not be forced to depend on methods they do not use.
Prefer several small, focused interfaces to one large one.
// Before: a read-only report is forced to implement write methods interface Storage { read(): string; write(s: string): void; delete(): void } // After interface Reader { read(): string } interface Writer { write(s: string): void }D: Dependency Inversion Principle
High-level policy should not depend on low-level details. Both should depend on abstractions.
The business rule owns an interface; the database, email service or queue implements it.
interface Mailer { send(to: string, body: string): Promise<void> } class SignUp { constructor(private mailer: Mailer) {} // depends on the abstraction async run(email: string) { await this.mailer.send(email, "Welcome"); } } // Production: new SignUp(new SmtpMailer()) Tests: new SignUp(new FakeMailer())This is the basis of dependency injection, makes code testable (swap in fakes) and keeps rules independent of technology. It underlies clean and hexagonal architecture (a later lesson).
Using SOLID well
- Start with simple code, and refactor when a change shows you the pain.
- Do not create an interface for every class "for SOLID". An abstraction needs at least two plausible implementations or a real need to isolate a dependency (a database, the clock, the network).
- Composition over inheritance: assemble behaviour from small parts rather than deep class trees.
- Small functions and modules are easier to keep single-purpose.
Real-world reading
Related reading
- Software Engineering DailySoftware Engineering DailyPodcasts & Newsletters
- Apache Flink: Concepts overviewApache Flink · Apache Software FoundationDocumentation
- Martin Fowler: Software Architecture GuideMartin FowlerBlogs
- Moving Core Business Search to Elasticsearch at YelpYelp engineers · YelpCase Studies
Show 6 moreShow fewer
- Explaining Low-Level Systems (OS, Network/Protocol, Database, Storage)Wustl engineers · WustlBlogs
- O'Reilly MySQL CE 2011: Jeremy Cole, "Big and Small Data at @Twitter"TwitterYouTube
- PostgreSQL: Using EXPLAINPostgreSQL Global Development Group · PostgreSQLDocumentation
- Managing Software Dependency at Scale at LinkedInScale at LinkedIn engineers · Scale at LinkedInCase Studies
- Top 10 Common Large-Scale Software Architectural Patterns in a NutshellTowardsdatascience engineers · TowardsdatascienceBlogs
- Single Repository at GoogleGoogle engineers · GoogleCase Studies
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as Top 10 Common Large-Scale Software Architectural Patterns in a Nutshell.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…