Engineering Guides

System design, product internals, programming correctness, engineering practice, and leadership. Choose a topic, understand its assumptions, then work through an example.

Choose a concept, then work through an example

123 guides in this section. Each article states its audience and assumptions, explains specialized terms, and gives a worked example or practical exercise.

Technical topics distinguish toy models from product behavior. Leadership topics distinguish context-dependent frameworks from evidence and personal claims.

System Design

System Design

01·Highly Reliable ServiceDefine reliability through user-visible outcomes, independent capacity, and bounded request-path behavior. 02·Unified Observability PlatformUnify metrics, logs, and traces through shared context while budgeting storage, coverage, and query isolation. 03·High-Volume Telemetry Ingestion PipelineAccept heterogeneous signals into bounded durable pipelines with clear per-signal delivery and privacy policies. 04·Distributed Log Search EngineBuild a searchable retained log with explicit visibility, durability, query completeness, and authorization boundaries. 05·Distributed Tracing SystemConnect distributed operations through propagated identities and interpret incomplete, sampled traces honestly. 06·Logs-to-Metrics Real-Time AlertingExtract stable metrics from events and alert on user-relevant budget consumption without hiding missing data. 07·Multi-Datacenter Routing & FailoverRecover from a lost or isolated region without promoting a stale or unauthorized writer. 08·Scaling from 10× to 100×Scale the measured bottleneck while preserving data and failure semantics as traffic grows. 09·Capacity Forecasting SystemForecast unconstrained demand and purchase enough surviving capacity before lead time runs out. 10·Petabyte-Scale Data PipelineReduce analytical bytes scanned and publish reproducible dataset versions despite task retries and late data. 11·Zero Data Loss During a Network PartitionPreserve acknowledged critical commits under network partitions while separating ordering, durability, and availability. 12·Testability in Distributed MicroservicesMake distributed logic reproducible in fast tests while recognizing what mocks and toy stores cannot prove. 13·Zero-Downtime Deployment & RollbackChange code and data in compatible stages while preserving a real rollback horizon and measuring user impact. 14·Consensus: Raft & PaxosUnderstand the state and protocol rules that let crash-recovering nodes preserve one committed history.

System Design Interview · Foundations

01·Rate LimiterTurn a quota into an explicit admission rule, choosing whether it limits bursts, trailing-window traffic, or a long-run rate. 02·Consistent Hashing & Key-Value StoreSpread a key-value store across changing servers without moving nearly every key, then reason separately about replication and read correctness. 03·Unique ID GeneratorEncode distributed IDs while separating uniqueness, approximate timestamp order, and safe restart behavior. 04·URL ShortenerBuild an atomic short-code mapping and a correct redirect path, including expiry, caching, and guessability. 05·Web CrawlerSchedule a bounded web crawl without overwhelming websites, losing queued URLs, or assuming every duplicate test is exact.

System Design Interview · Counting & Analytics

01·Count Unique Active UsersEstimate distinct active users cheaply and understand why merging sketches is different from adding daily counts. 02·Trending Topics / Top-KFind frequent items while separating approximate frequency error from missing candidate identities. 03·Ad Click / Impression CounterCount impressions and clicks from a replayable event stream, while distinguishing provisional dashboard numbers from auditable billing. 04·Metrics / Time-Series StoreStore timestamped metric series while preserving the meaning of counters, gauges, and aggregated distributions. 05·Logging / Analytics PipelineMove structured events from applications to independent searchable, analytical, and archival sinks with a bounded loss/replay policy.

System Design Interview · Feeds, Messaging & Social

01·Notification SystemAccept notification intent reliably and distinguish provider acceptance, device delivery, and a user's observation. 02·News Feed SystemChoose push, pull, or hybrid feeds from measured amplification, then serve stable pages with current privacy rules. 03·Chat SystemDeliver and synchronize messages across intermittent devices without confusing message identity with committed delivery order. 04·Social GraphMaintain directed edges and reverse indexes without losing unfollow ordering or using stale edges for authorization. 05·Live Comments / PresenceBroadcast a bounded live comment stream while keeping durable acceptance distinct from the subset shown to viewers.

System Design Interview · Search, Geo & Logistics

01·Search AutocompleteServe ranked prefix completions from a normalized, versioned snapshot without traversing a huge subtree on each keystroke. 02·Proximity Service (Nearby Places)Find nearby points by a conservative spatial covering, then refine and rank without missing boundary neighbors. 03·Ride Matching (Dispatch)Use approximate location candidates but one authoritative state transition for exclusive trip assignment. 04·Package / Delivery TrackingTurn messy carrier scans into a trustworthy shipment history and a reproducible current-state projection.

System Design Interview · Media & Collaboration

01·Video Platform (YouTube)Turn a validated upload into compatible streaming renditions through a recoverable dependency graph. 02·Cloud Storage (Google Drive)Synchronize immutable file versions while keeping metadata publication, blob lifetime, and conflicts correct. 03·Collaborative Editing (Docs)Explain how concurrent edits converge while separating a two-operation demo from a complete collaboration protocol.

System Design Interview · Coordination, Money & Markets

01·Distributed Lock / Leader ElectionCoordinate work without letting expired, paused holders corrupt protected resources. 02·Idempotency / Exactly-OnceMake repeated API attempts produce one logical effect despite concurrent retries and uncertain remote outcomes. 03·Payment / Wallet SystemRepresent money as auditable postings and enforce balances, currency, and retries transactionally. 04·Ad Auction / Real-Time BiddingAllocate ads under specified pricing, deadlines, and spend/exposure accounting. 05·Ticket Booking (Inventory)Hold scarce seats during checkout and reject stale payment or expiry callbacks.

System Design Interview · Patterns

01·Common PatternsChoose reusable design mechanisms from requirements and explain their correctness costs before choosing products.

Reference

System Internals Guides

01·Apache CassandraSeparate Cassandra's partition placement, timestamp reconciliation, consistency levels, and crash durability. 02·OpenObserveFollow telemetry from stateful ingestion to immutable analytical files and a versioned query catalog. 03·MinIOUnderstand how an object store reconstructs bytes from erasure-coded shards and safely publishes versions. 04·RedisUnderstand isolated commands, in-memory state, expiry, persistence, and asynchronous failover as separate mechanisms. 05·Apache KafkaUnderstand a partition log, replica visibility, producer retries, and consumer recovery without conflating them. 06·Apache FlinkUnderstand recoverable stream state, event-time windows, and bounded flow control. 07·ZooKeeperUnderstand versioned coordination, session liveness, ordered writes, and possibly stale reads. 08·NGINXUnderstand event-driven proxying and reloads without assuming idle connections are free or every reload is lossless. 09·ElasticsearchSeparate indexed durability, search refresh, replica state, and query completeness. 10·Apache LuceneUnderstand documents, postings, reader snapshots, and durable commits beneath search products.

Find a guide

123 guides

Crucial Conversations — Concepts and Practical Examples

Practice discussing consequential disagreement through facts, tentative interpretations, and shared understanding.

Dialogue and the STATE framework · SBI feedback and observable behavior · Psychological safety and constructive conflict · Stakeholders and alignment · Frameworks versus empirical evidence

An Elegant Puzzle — Concepts and Practical Examples

Use organizational-system models to choose workload and capacity interventions without treating heuristics as universal rules.

Team states as an organizational heuristic · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement · Opportunity cost and prioritization · Coaching, delegation, and expectations

The Five Dysfunctions of a Team — Concepts and Practical Examples

Use a team's trust, debate, commitment, accountability, and results as discussion prompts rather than a diagnosis.

Five dysfunctions as a team framework · Psychological safety and constructive conflict · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement · Frameworks versus empirical evidence

Leaders Eat Last — Concepts and Practical Examples

Apply service-oriented leadership while distinguishing a practical principle from simplified biological explanations.

Circle of Safety as a leadership principle · Psychological safety and constructive conflict · Coaching, delegation, and expectations · Outputs, outcomes, and measurement · Frameworks versus empirical evidence

The Manager's Path — Concepts and Practical Examples

Understand how mentoring, technical leadership, and management responsibilities change with scope.

Management scope and technical leadership · Coaching, delegation, and expectations · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement · Stakeholders and alignment

Mindset — Concepts and Practical Examples

Use learning-oriented beliefs with effective strategies and support without blaming outcomes on attitude alone.

Growth mindset as a learning belief · Coaching, delegation, and expectations · SBI feedback and observable behavior · Frameworks versus empirical evidence · Outputs, outcomes, and measurement

Radical Candor — Concepts and Practical Examples

Give specific respectful feedback while recognizing professional boundaries, power, and individual preferences.

Care personally and challenge directly · SBI feedback and observable behavior · Psychological safety and constructive conflict · Coaching, delegation, and expectations · Frameworks versus empirical evidence

Staff Engineer — Concepts and Practical Examples

Understand staff-plus scope, influence, and enabling work without confusing archetypes with universal titles.

Staff-plus archetypes and scope · Ownership, accountability, and decision rights · Stakeholders and alignment · Decision records and reversible experiments · Outputs, outcomes, and measurement

Thinking, Fast and Slow — Concepts and Practical Examples

Use heuristics and statistical thinking to question confident stories without turning bias labels into universal explanations.

System 1, System 2, and evidence limits · Frameworks versus empirical evidence · Decision records and reversible experiments · Outputs, outcomes, and measurement · Opportunity cost and prioritization

Reviewing API, Schema & Query Compatibility

Review binary, schema, and semantic compatibility across old/new readers and writers.

Schema compatibility and semantic contracts · Expand-contract migrations · Ownership, accountability, and decision rights · Preconditions and postconditions · Outputs, outcomes, and measurement

Reviewing Correctness in Distributed & Concurrent Code

Review replay, races, partial failure, and ordering at the effect's actual transactional boundary.

Idempotency keys · Offsets and checkpoints · Transactional outbox · Optimistic concurrency and compare-and-set · Fencing tokens

Reviewing for Observability & Operability

Review whether a new behavior can be detected and explained without unsafe or excessive telemetry.

SLIs, SLOs, and error budgets · Burn-rate alerting · Cardinality · Spans and trace context · Outputs, outcomes, and measurement

Reviewing for Performance, Scalability & Reliability

Review costs and failure amplification against the actual workload rather than optimizing by intuition.

Complexity and workload assumptions · Backpressure and load shedding · Outputs, outcomes, and measurement · Event loops and nonblocking I/O · Preconditions and postconditions

Code Review Beyond Correctness

Review intent, correctness, maintainability, and operational/security risk with a proportionate attention budget.

Preconditions and postconditions · Decision records and reversible experiments · SBI feedback and observable behavior · Outputs, outcomes, and measurement · Ownership, accountability, and decision rights

Reviewing for Privacy & Compliance

Review data purpose, minimization, access, retention, and deletion with an explicit privacy owner.

Privacy, minimization, and pseudonymity · Authentication, authorization, and IDOR · Schema compatibility and semantic contracts · Ownership, accountability, and decision rights · Frameworks versus empirical evidence

Pushing Back on a Design or Implementation

Disagree on a design using a shared problem, evidence, alternatives, and clear decision authority.

Decision records and reversible experiments · Stakeholders and alignment · SBI feedback and observable behavior · Ownership, accountability, and decision rights · STAR and CARL interview structure

Reviewing a Security-Critical Change

Review threats, object-level authorization, input boundaries, retries, and rollout before trusting a transaction path.

Authentication, authorization, and IDOR · Privacy, minimization, and pseudonymity · Idempotency keys · Optimistic concurrency and compare-and-set · Preconditions and postconditions

Driving Platform Adoption

Earn useful platform adoption by solving a customer problem and making migration costs and constraints explicit.

Stakeholders and alignment · Outputs, outcomes, and measurement · Opportunity cost and prioritization · Ownership, accountability, and decision rights · Expand-contract migrations

Delivering Under Ambiguity

Turn an unclear mandate into a testable problem and a bounded decision rather than an unsupported commitment.

Decision records and reversible experiments · Stakeholders and alignment · Outputs, outcomes, and measurement · Opportunity cost and prioritization

Navigating Conflict & Breaking Stakeholder Deadlocks

Resolve stakeholder conflict by examining interests, constraints, and explicit decision authority.

Stakeholders and alignment · Decision records and reversible experiments · Ownership, accountability, and decision rights · Psychological safety and constructive conflict · STAR and CARL interview structure

Aligning Engineering with Finance & Physical Infra

Connect software demand to physical capacity, budgets, lead times, and failure headroom.

Forecast percentiles and headroom · Failure domains and redundant capacity · Opportunity cost and prioritization · Outputs, outcomes, and measurement · Stakeholders and alignment

Partnering with Downstream Consumers & Driving Standardization

Evolve a shared interface while preserving supported reader/writer semantics and a usable deprecation path.

Schema compatibility and semantic contracts · Expand-contract migrations · Ownership, accountability, and decision rights · Stakeholders and alignment · SLIs, SLOs, and error budgets

When a Timezone or Cultural Breakdown Threatens a Release

Repair cross-timezone communication with shared written context and equitable confirmation.

Stakeholders and alignment · Ownership, accountability, and decision rights · Psychological safety and constructive conflict · Decision records and reversible experiments

Collaborating During Major Incidents

Coordinate incident response around safe mitigation, role clarity, communication, and sustained learning.

Ownership, accountability, and decision rights · Toil, incident response, and error budgets · SLIs, SLOs, and error budgets · Outputs, outcomes, and measurement · Decision records and reversible experiments

Influence Without Authority

Build legitimate cross-team support through value, evidence, lower friction, and clear escalation.

Stakeholders and alignment · Opportunity cost and prioritization · Ownership, accountability, and decision rights · Decision records and reversible experiments · Outputs, outcomes, and measurement

Leading a Cross-functional Migration

Coordinate a migration through tested compatible phases and finish under a safe retirement policy.

Expand-contract migrations · Transactional outbox · Idempotency keys · Canaries, shadow traffic, and rollout gates · Ownership, accountability, and decision rights

Pushing Back on a Release Under Business Pressure

Translate release risk into concrete user/business consequences and safe options without bypassing nonnegotiable obligations.

Decision records and reversible experiments · Canaries, shadow traffic, and rollout gates · SLIs, SLOs, and error budgets · Ownership, accountability, and decision rights · Opportunity cost and prioritization

When a Critical Dependency or Remote Team Falls Behind

Respond to a dependency delay with joint evidence, support, realistic replanning, and explicit fallback constraints.

Stakeholders and alignment · Ownership, accountability, and decision rights · Decision records and reversible experiments · Opportunity cost and prioritization · Outputs, outcomes, and measurement

Cross-functional Collaboration — Concept Explorer

Explore cross-team collaboration with explicit constraints, legitimate authority, and shared evidence.

Stakeholders and alignment · Decision records and reversible experiments · Ownership, accountability, and decision rights · Opportunity cost and prioritization · Outputs, outcomes, and measurement

People Management - Concept Explorer

Explore people-management concepts with explicit context, fair support, and professional boundaries.

Coaching, delegation, and expectations · SBI feedback and observable behavior · Ownership, accountability, and decision rights · Psychological safety and constructive conflict · Outputs, outcomes, and measurement

02 · Technical Design

Explain technical leadership from requirements, alternatives, guarantees, and measured evidence.

STAR and CARL interview structure · Decision records and reversible experiments · Preconditions and postconditions · SLIs, SLOs, and error budgets · Outputs, outcomes, and measurement

04 · Operational Leadership

Explain operational leadership through safe recovery, measurement, ownership, and sustained improvement.

STAR and CARL interview structure · Toil, incident response, and error budgets · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement · SLIs, SLOs, and error budgets

01 · Project / Roadmap Leadership

Explain roadmap choices through user outcomes, constraints, dependencies, and explicit opportunity costs.

STAR and CARL interview structure · Opportunity cost and prioritization · Ownership, accountability, and decision rights · Stakeholders and alignment · Outputs, outcomes, and measurement

03 · SRE Partnership

Explain SRE partnership using defined user outcomes, error budgets, safe response, and operational load.

SLIs, SLOs, and error budgets · Burn-rate alerting · Toil, incident response, and error budgets · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement

Coaching Senior Engineers Who Disagree

Lead expert disagreement by clarifying the decision, constraints, and evidence rather than trying to out-argue the expert.

Coaching, delegation, and expectations · Decision records and reversible experiments · Ownership, accountability, and decision rights · Psychological safety and constructive conflict · STAR and CARL interview structure

Building a Culture of Ownership & Operational Excellence

Build ownership and operational learning through authority, incentives, clear standards, and fair accountability.

Ownership, accountability, and decision rights · Psychological safety and constructive conflict · Toil, incident response, and error budgets · SLIs, SLOs, and error budgets · Outputs, outcomes, and measurement

Technical Decision-Making Under Ambiguity

Make timely technical decisions with explicit uncertainty, reversibility, and review triggers.

Decision records and reversible experiments · Opportunity cost and prioritization · Stakeholders and alignment · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement

Delegating Without Abdicating

Delegate real decision authority with constraints, resources, support, and a clear escalation path.

Coaching, delegation, and expectations · Ownership, accountability, and decision rights · Decision records and reversible experiments · Outputs, outcomes, and measurement

Managing Globally Distributed Teams

Design distributed collaboration around overlap, durable written context, and equitable participation.

Stakeholders and alignment · Ownership, accountability, and decision rights · Decision records and reversible experiments · Psychological safety and constructive conflict · Outputs, outcomes, and measurement

Mediating Engineering vs. Product Friction

Resolve engineering/product tension through a shared outcome and explicit risk/value tradeoffs.

Stakeholders and alignment · Opportunity cost and prioritization · Decision records and reversible experiments · SLIs, SLOs, and error budgets · Outputs, outcomes, and measurement

Growing Engineers into Technical Leaders

Grow technical leadership through scoped ownership, coaching, sponsorship, and equitable opportunities.

Coaching, delegation, and expectations · Ownership, accountability, and decision rights · Stakeholders and alignment · Outputs, outcomes, and measurement

Delivering High-Stakes Feedback & Retaining Talent

Deliver consequential feedback with specific evidence, listening, fairness, and agreed next steps.

SBI feedback and observable behavior · Coaching, delegation, and expectations · Psychological safety and constructive conflict · Outputs, outcomes, and measurement

Protecting a Team from On-Call Burnout

Protect sustainable operations through workload evidence, staffing, alert quality, and recovery time.

Toil, incident response, and error budgets · SLIs, SLOs, and error budgets · Outputs, outcomes, and measurement · Ownership, accountability, and decision rights · Coaching, delegation, and expectations

Defining Success for a Platform Team

Measure platform success through user outcomes, reliability, adoption quality, and cost with explicit denominators.

Outputs, outcomes, and measurement · SLIs, SLOs, and error budgets · Cardinality · Opportunity cost and prioritization

Instilling Product Thinking in Engineers

Connect engineering decisions to customer problems, viable constraints, and measured adoption.

Outputs, outcomes, and measurement · Stakeholders and alignment · Opportunity cost and prioritization · Decision records and reversible experiments

Scaling a Team While Holding Quality

Scale team ownership and coordination while preserving quality, onboarding support, and fair workload.

Ownership, accountability, and decision rights · Coaching, delegation, and expectations · Stakeholders and alignment · Outputs, outcomes, and measurement · Psychological safety and constructive conflict

Managing a Toxic High-Performer

Address harmful workplace behavior with observable evidence and a fair process, even when technical results are strong.

SBI feedback and observable behavior · Psychological safety and constructive conflict · Coaching, delegation, and expectations · Outputs, outcomes, and measurement · Ownership, accountability, and decision rights

Managing Underperformance

Respond to performance concerns through explicit expectations, context, support, and fair confidential processes.

Coaching, delegation, and expectations · SBI feedback and observable behavior · Outputs, outcomes, and measurement · Psychological safety and constructive conflict · Ownership, accountability, and decision rights

Leadership Interview Playbook

Organize leadership interview practice around actual decisions, evidence, tradeoffs, and learning.

STAR and CARL interview structure · Decision records and reversible experiments · Ownership, accountability, and decision rights · Outputs, outcomes, and measurement · Stakeholders and alignment

Interview Story Bank

Prepare a truthful story catalog with clear role, evidence, applicability, and confidentiality limits.

STAR and CARL interview structure · Outputs, outcomes, and measurement · Ownership, accountability, and decision rights · Privacy, minimization, and pseudonymity · Frameworks versus empirical evidence

Basic Algorithms & Patterns

Choose an algorithm from input constraints, then check its boundary cases and cost.

Preconditions and postconditions · Loop invariants · Variants and well-founded orders · Complexity and workload assumptions · Recursion and induction

Code Smells — A Practical Refactoring Guide

Use maintainability symptoms to identify a behavior-preserving refactoring, not to add patterns automatically.

Refactoring and code smells · Liskov substitution and interfaces · Preconditions and postconditions · Aliasing and frame conditions · Strategy, Adapter, and Observer

Design Patterns — A Practical Reference

Understand what coupling each design pattern addresses and when simpler composition is sufficient.

Strategy, Adapter, and Observer · Liskov substitution and interfaces · Refactoring and code smells · Aliasing and frame conditions · Preconditions and postconditions

Scrum — A Practical Guide

Understand Scrum's commitments and feedback loop while separating optional estimation practices from framework requirements.

Scrum empiricism and commitments · Definition of Done versus acceptance criteria · Outputs, outcomes, and measurement · Ownership, accountability, and decision rights · Stakeholders and alignment

Apache Cassandra — Internal Architecture

Separate Cassandra's partition placement, timestamp reconciliation, consistency levels, and crash durability.

Consistent hashing · Quorum · LSM trees, memtables, and SSTables · Tombstones · Schema compatibility and semantic contracts · Linearizability

Elasticsearch — Internal Architecture

Separate indexed durability, search refresh, replica state, and query completeness.

Refresh, commit, and reader snapshots · Analyzers, postings, and doc values · Inverted indexes and columnar storage · Optimistic concurrency and compare-and-set · Offsets and checkpoints · Schema compatibility and semantic contracts

Apache Flink — Internal Architecture

Understand recoverable stream state, event-time windows, and bounded flow control.

Keyed state, checkpoints, and savepoints · Event time and watermarks · Offsets and checkpoints · Backpressure and load shedding · Cardinality

Apache Kafka — Internal Architecture

Understand a partition log, replica visibility, producer retries, and consumer recovery without conflating them.

Log offsets and commit boundaries · Producer idempotence and transactions · Schema compatibility and semantic contracts · Offsets and checkpoints · Backpressure and load shedding · Write-ahead log and fsync

Apache Lucene — Internal Architecture

Understand documents, postings, reader snapshots, and durable commits beneath search products.

Analyzers, postings, and doc values · BM25 ranking · Refresh, commit, and reader snapshots · Inverted indexes and columnar storage · Complexity and workload assumptions

MinIO — Internal Architecture

Understand how an object store reconstructs bytes from erasure-coded shards and safely publishes versions.

Reed–Solomon erasure coding · Quorum · Failure domains and redundant capacity · Multi-tenancy and publication lifetime · Content addressing and garbage collection

NGINX — Internal Architecture

Understand event-driven proxying and reloads without assuming idle connections are free or every reload is lossless.

Event loops and nonblocking I/O · Reverse proxy, buffering, and graceful reload · Cache-aside and invalidation · Backpressure and load shedding · Wall and monotonic clocks

OpenObserve — Internal Architecture

Follow telemetry from stateful ingestion to immutable analytical files and a versioned query catalog.

Multi-tenancy and publication lifetime · Write-ahead log and fsync · Partition pruning and predicate pushdown · Inverted indexes and columnar storage · Offsets and checkpoints · Rollups and weighted aggregation

Redis — Internal Architecture

Understand isolated commands, in-memory state, expiry, persistence, and asynchronous failover as separate mechanisms.

Isolation is not rollback · Snapshots, AOF, and power-loss durability · Event loops and nonblocking I/O · Wall and monotonic clocks · Cache-aside and invalidation · Quorum

Apache ZooKeeper — Internal Architecture

Understand versioned coordination, session liveness, ordered writes, and possibly stale reads.

znodes, sessions, and watches · ZAB and ZooKeeper consistency · Quorum · Fencing tokens · Leases · Optimistic concurrency and compare-and-set

The Science of Programming — Gries, Distilled

Connect a specification to an algorithm through predicates, weakest preconditions, invariants, and termination.

Preconditions and postconditions · Predicates and state · Hoare triples and total correctness · Weakest preconditions · Loop invariants · Variants and well-founded orders

Foundations — Why Correctness, and the Logic of Propositions

Read propositions, equivalence, and implication as precise statements about program behavior.

Predicates and state · Quantifiers and implication · Preconditions and postconditions · Hoare triples and total correctness

Predicates, States & Quantification

Use predicates, quantifiers, and capture-free substitution to specify arrays and state.

Predicates and state · Quantifiers and implication · Substitution without capture · Preconditions and postconditions · Aliasing and frame conditions

The Predicate Transformer wp

Compute entry requirements backward from a desired output while keeping termination and definedness explicit.

Weakest preconditions · Substitution without capture · Hoare triples and total correctness · Predicates and state · Guarded commands and nondeterminism

Basic Commands & the Assignment Axiom

Translate assignment and sequencing into predicates, including parallel assignment and array updates.

Weakest preconditions · Substitution without capture · Aliasing and frame conditions · Preconditions and postconditions

The Alternative Command — Guarded Selection (IF)

Understand guard coverage and correctness for every enabled nondeterministic branch.

Guarded commands and nondeterminism · Weakest preconditions · Predicates and state · Preconditions and postconditions

The Iterative Command — Loops, Invariants & Bounds

Prove a loop by establishing and preserving its invariant and showing a decreasing well-founded measure.

Loop invariants · Variants and well-founded orders · Hoare triples and total correctness · Preconditions and postconditions · Guarded commands and nondeterminism

Developing Programs — Goal-Oriented Construction & Inventing Invariants

Invent an invariant from the required result and use it to choose safe state updates.

Preconditions and postconditions · Loop invariants · Variants and well-founded orders · Weakest preconditions

Worked Examples — From Specification to Correct Program

Connect array sums, division, search, maxima, power, GCD, and partitioning to their complete contracts.

Preconditions and postconditions · Loop invariants · Variants and well-founded orders · Guarded commands and nondeterminism · Complexity and workload assumptions

A Natural Deduction Proof System

Build proofs with explicit assumptions, valid inference rules, and correctly discharged scopes.

Predicates and state · Quantifiers and implication · Hoare triples and total correctness · Guarded commands and nondeterminism

The Procedure Call

Use procedure contracts while preserving old input values, frame conditions, and parameter-mode assumptions.

Preconditions and postconditions · Aliasing and frame conditions · Hoare triples and total correctness · Recursion and induction · Substitution without capture

Bound Functions & Termination

Choose genuinely decreasing measures and recognize invalid termination examples.

Variants and well-founded orders · Loop invariants · Quantifiers and implication · Complexity and workload assumptions

Iteration Instead of Recursion

Translate a recurrence into an iterative accumulator or explicit stack with a clear invariant.

Recursion and induction · Loop invariants · Variants and well-founded orders · Aliasing and frame conditions · Complexity and workload assumptions

Efficiency — Strengthening Invariants

Optimize through maintained relations without changing numeric or observable semantics accidentally.

Refinement and observational equivalence · Loop invariants · Complexity and workload assumptions · Preconditions and postconditions

Two Larger Developments

Derive intersection and sorted-matrix search from shrinking candidate regions.

Loop invariants · Variants and well-founded orders · Preconditions and postconditions · Quantifiers and implication · Complexity and workload assumptions

Inverting Programs

Understand reversible mappings on explicit domains and why overwritten information may prevent undo.

Program inversion and lost information · Preconditions and postconditions · Aliasing and frame conditions · Variants and well-founded orders

Documenting Programs & Historical Notes

Document the specification, invariant, frame, and progress argument that readers need to maintain correct code.

Preconditions and postconditions · Loop invariants · Variants and well-founded orders · Hoare triples and total correctness · Refinement and observational equivalence

Designing an Ad Auction (RTB)

Allocate ads under specified pricing, deadlines, and spend/exposure accounting.

First-price, second-price, and GSP · Budget reservations and pacing · Token bucket · Deduplication · Backpressure and load shedding · Wall and monotonic clocks

Designing a Distributed Lock

Coordinate work without letting expired, paused holders corrupt protected resources.

Leases · Fencing tokens · Quorum · Raft terms and commit rules · Optimistic concurrency and compare-and-set · Wall and monotonic clocks

Designing for Idempotency & Exactly-Once

Make repeated API attempts produce one logical effect despite concurrent retries and uncertain remote outcomes.

Idempotency keys · Optimistic concurrency and compare-and-set · Transactional outbox · Sagas and compensation · Leases · Offsets and checkpoints

Designing a Payment / Wallet System

Represent money as auditable postings and enforce balances, currency, and retries transactionally.

Double-entry ledger · Optimistic concurrency and compare-and-set · Idempotency keys · Sagas and compensation · Transactional outbox · CAP and consistency models

Designing a Ticket Booking System

Hold scarce seats during checkout and reject stale payment or expiry callbacks.

Optimistic concurrency and compare-and-set · Leases · Idempotency keys · Sagas and compensation · Fencing tokens · Backpressure and load shedding

Designing an Ad Click / Impression Counter

Count impressions and clicks from a replayable event stream, while distinguishing provisional dashboard numbers from auditable billing.

Deduplication · Bloom filters · Offsets and checkpoints · Event time and watermarks · Rollups and weighted aggregation · Transactional outbox

Counting Unique Active Users at Scale

Estimate distinct active users cheaply and understand why merging sketches is different from adding daily counts.

HyperLogLog · Cardinality · Event time and watermarks · Offsets and checkpoints · Deduplication

Designing a Logging / Analytics Pipeline

Move structured events from applications to independent searchable, analytical, and archival sinks with a bounded loss/replay policy.

Pub/sub and durable queues · Offsets and checkpoints · Write-ahead log and fsync · Backpressure and load shedding · Deduplication · Transactional outbox

Designing a Metrics / Time-Series Store

Store timestamped metric series while preserving the meaning of counters, gauges, and aggregated distributions.

Cardinality · Rollups and weighted aggregation · Write-ahead log and fsync · Inverted indexes and columnar storage · Event time and watermarks · Offsets and checkpoints

Trending Topics and Top-K

Find frequent items while separating approximate frequency error from missing candidate identities.

Count-Min Sketch · Top-k candidate discovery · Time windows · Offsets and checkpoints · Cardinality

Designing a Chat System

Deliver and synchronize messages across intermittent devices without confusing message identity with committed delivery order.

Sequence numbers and replay cursors · Idempotency keys · Fanout on write and read · Presence and failure detection · Transactional outbox · Pub/sub and durable queues

Designing Live Comments / Presence

Broadcast a bounded live comment stream while keeping durable acceptance distinct from the subset shown to viewers.

Fanout on write and read · Pub/sub and durable queues · Sequence numbers and replay cursors · Presence and failure detection · Backpressure and load shedding · Token bucket

Designing a News Feed System

Choose push, pull, or hybrid feeds from measured amplification, then serve stable pages with current privacy rules.

Fanout on write and read · Cache-aside and invalidation · Sequence numbers and replay cursors · Transactional outbox · Backpressure and load shedding · Top-k candidate discovery

Designing a Notification System

Accept notification intent reliably and distinguish provider acceptance, device delivery, and a user's observation.

Transactional outbox · Idempotency keys · Sagas and compensation · Backpressure and load shedding · Leases · Pub/sub and durable queues

Designing a Social Graph

Maintain directed edges and reverse indexes without losing unfollow ordering or using stale edges for authorization.

Transactional outbox · Optimistic concurrency and compare-and-set · Replication · Fanout on write and read · Cache-aside and invalidation · Cardinality

Consistent Hashing & Designing a Key-Value Store

Spread a key-value store across changing servers without moving nearly every key, then reason separately about replication and read correctness.

Consistent hashing · Virtual nodes · Quorum · Linearizability · Vector clocks · Merkle trees · Tombstones

Designing a Rate Limiter

Turn a quota into an explicit admission rule, choosing whether it limits bursts, trailing-window traffic, or a long-run rate.

Token bucket · Time windows · Atomic Redis scripts · Wall and monotonic clocks · Backpressure and load shedding · Leases

Designing a Unique ID Generator

Encode distributed IDs while separating uniqueness, approximate timestamp order, and safe restart behavior.

Snowflake IDs · Wall and monotonic clocks · Leases · Fencing tokens · Optimistic concurrency and compare-and-set

Designing a URL Shortener

Build an atomic short-code mapping and a correct redirect path, including expiry, caching, and guessability.

Base62 encoding · Idempotency keys · Cache-aside and invalidation · Optimistic concurrency and compare-and-set · Replication

Designing a Web Crawler

Schedule a bounded web crawl without overwhelming websites, losing queued URLs, or assuming every duplicate test is exact.

Crawl frontier and politeness · Bloom filters · Deduplication · Transactional outbox · Leases · Backpressure and load shedding

Designing Collaborative Editing

Explain how concurrent edits converge while separating a two-operation demo from a complete collaboration protocol.

Operational Transformation · Conflict-free Replicated Data Types · Sequence numbers and replay cursors · Idempotency keys · Presence and failure detection · Tombstones

Designing a Cloud File Storage / Sync Service

Synchronize immutable file versions while keeping metadata publication, blob lifetime, and conflicts correct.

Resumable and multipart uploads · Content-defined chunking · Content addressing and garbage collection · Optimistic concurrency and compare-and-set · Cache-aside and invalidation · Transactional outbox

Designing a Video Platform

Turn a validated upload into compatible streaming renditions through a recoverable dependency graph.

Resumable and multipart uploads · DAG scheduling · Adaptive bitrate streaming · Content addressing and garbage collection · Transactional outbox · Backpressure and load shedding

Common Patterns

Choose reusable design mechanisms from requirements and explain their correctness costs before choosing products.

Cache-aside and invalidation · Optimistic concurrency and compare-and-set · Fencing tokens · Transactional outbox · Sagas and compensation · Geohash · Backpressure and load shedding · Idempotency keys

Designing a Capacity Forecasting System

Forecast unconstrained demand and purchase enough surviving capacity before lead time runs out.

Forecast percentiles and headroom · Failure domains and redundant capacity · SLIs, SLOs, and error budgets · Cardinality · Backpressure and load shedding

Consensus: Raft & Paxos

Understand the state and protocol rules that let crash-recovering nodes preserve one committed history.

Raft terms and commit rules · Quorum · Write-ahead log and fsync · Linearizability · CAP and consistency models · Fencing tokens

Designing a Distributed Tracing System

Connect distributed operations through propagated identities and interpret incomplete, sampled traces honestly.

Spans and trace context · Head and tail sampling · Transactional outbox · Cardinality · SLIs, SLOs, and error budgets

Designing a Distributed Log Search Engine

Build a searchable retained log with explicit visibility, durability, query completeness, and authorization boundaries.

Inverted indexes and columnar storage · Partition pruning and predicate pushdown · Write-ahead log and fsync · Offsets and checkpoints · Cardinality

Designing a Logs-to-Metrics Real-Time Alerting Pipeline

Extract stable metrics from events and alert on user-relevant budget consumption without hiding missing data.

Event time and watermarks · Rollups and weighted aggregation · Cardinality · Burn-rate alerting · SLIs, SLOs, and error budgets · Offsets and checkpoints

Designing Global Multi-Datacenter Routing & Failover

Recover from a lost or isolated region without promoting a stale or unauthorized writer.

RPO and RTO · Failure domains and redundant capacity · Quorum · Fencing tokens · Replication · CAP and consistency models

Designing a Unified Observability Platform

Unify metrics, logs, and traces through shared context while budgeting storage, coverage, and query isolation.

Spans and trace context · Head and tail sampling · Cardinality · Inverted indexes and columnar storage · Rollups and weighted aggregation · Backpressure and load shedding · SLIs, SLOs, and error budgets

Zero Data Loss During a Network Partition

Preserve acknowledged critical commits under network partitions while separating ordering, durability, and availability.

CAP and consistency models · Quorum · Raft terms and commit rules · Write-ahead log and fsync · Linearizability · Failure domains and redundant capacity · Fencing tokens

Designing a Petabyte-Scale Data Pipeline with Strong SLAs

Reduce analytical bytes scanned and publish reproducible dataset versions despite task retries and late data.

Partition pruning and predicate pushdown · Inverted indexes and columnar storage · Offsets and checkpoints · Event time and watermarks · DAG scheduling · Transactional outbox

Designing a Highly Reliable Service

Define reliability through user-visible outcomes, independent capacity, and bounded request-path behavior.

SLIs, SLOs, and error budgets · Burn-rate alerting · Failure domains and redundant capacity · Backpressure and load shedding · Idempotency keys · Wall and monotonic clocks

Scaling a System from 10× to 100×

Scale the measured bottleneck while preserving data and failure semantics as traffic grows.

Cache-aside and invalidation · Consistent hashing · Replication · Backpressure and load shedding · Failure domains and redundant capacity · Transactional outbox

Designing a High-Volume Telemetry Ingestion Pipeline

Accept heterogeneous signals into bounded durable pipelines with clear per-signal delivery and privacy policies.

Offsets and checkpoints · Backpressure and load shedding · Pub/sub and durable queues · Cardinality · Transactional outbox · Spans and trace context

Designing for Testability in Distributed Microservices

Make distributed logic reproducible in fast tests while recognizing what mocks and toy stores cannot prove.

Dependency injection and test doubles · Optimistic concurrency and compare-and-set · Wall and monotonic clocks · Canaries, shadow traffic, and rollout gates · SLIs, SLOs, and error budgets · Idempotency keys

Zero-Downtime Deployment & Rollback

Change code and data in compatible stages while preserving a real rollback horizon and measuring user impact.

Expand-contract migrations · Canaries, shadow traffic, and rollout gates · Optimistic concurrency and compare-and-set · Transactional outbox · SLIs, SLOs, and error budgets · Failure domains and redundant capacity

Designing Package / Delivery Tracking

Turn messy carrier scans into a trustworthy shipment history and a reproducible current-state projection.

State machines and projections · Event time and watermarks · Deduplication · Optimistic concurrency and compare-and-set · Transactional outbox · ETA and uncertainty

Designing a Proximity Service

Find nearby points by a conservative spatial covering, then refine and rank without missing boundary neighbors.

Geohash · Quadtree and adaptive spatial indexing · ETA and uncertainty · Inverted indexes and columnar storage · Cache-aside and invalidation

Designing a Ride Matching Service

Use approximate location candidates but one authoritative state transition for exclusive trip assignment.

Geohash · ETA and uncertainty · Optimistic concurrency and compare-and-set · Leases · State machines and projections · Transactional outbox

Designing a Search Autocomplete System

Serve ranked prefix completions from a normalized, versioned snapshot without traversing a huge subtree on each keystroke.

Trie and cached prefix top-k · Top-k candidate discovery · Cardinality · Cache-aside and invalidation · DAG scheduling