StackPractices

design

Practical resources about design for software engineers.

150 results

Patterns for Maintainable Code

Design patterns are not cookbook recipes — they are a shared vocabulary for discussing solutions to recurring problems. Knowing when to apply (and when to avoid) a pattern is a hallmark of senior engineering.

Browse our catalog of creational, structural, and behavioral patterns. Each entry includes a real-world scenario, UML diagrams, implementation in multiple languages, and a discussion of trade-offs. From Singleton to Outbox, find the right tool for your context.

advanced

Scheduler Agent Supervisor Pattern

Coordinate resilient job scheduling with a supervisor that monitors agents, restarts failures, and...

intermediate

Sequential Convoy Pattern

Preserve message ordering for related messages in a distributed system by routing each entity's...

advanced

Serverless Event Sourcing Pattern

Store function state as an append-only event log so workflows can be replayed, audited, and...

intermediate

Serverless Fanout Pattern

Broadcast a single event to multiple independent consumers via SNS, EventBridge, or SQS so each...

advanced

Serverless Function Composition Pattern

Chain serverless functions via Step Functions or orchestration layers to build multi-step workflows...

advanced

Serverless Throttling Pattern

Handle backpressure in serverless by using SQS, token buckets, and concurrency limits to protect...

intermediate

Serverless Warm Pool Pattern

Keep Lambda functions warm by sending periodic ping events to reduce cold start latency for...

advanced

Sharding Pattern

Split a large dataset into smaller partitions (shards) distributed across multiple servers to...

beginner

Singleton Pattern: Java, Python & TypeScript Examples

Ensure a class has only one instance and provide global access to it — the creational design...

intermediate

SOLID Principles in TypeScript with Practical Examples

Apply the five SOLID principles to TypeScript code to improve maintainability, testability, and...

intermediate

Specification Pattern

Encapsulate business rules for selecting objects as reusable, composable predicate objects that can...

intermediate

State Pattern

Allow an object to alter its behavior when its internal state changes. The GoF behavioral pattern...

beginner

Static Content Hosting Pattern

Deploy static files to a dedicated content delivery network or object storage to offload origin...

beginner

Strategy Pattern

Define a family of algorithms, encapsulate each one, and make them interchangeable. A behavioral...

beginner

Template Method Pattern

Define an algorithm's skeleton in a base class and let subclasses fill in the steps. The GoF...

intermediate

Throttling Pattern

Limit the rate at which a system processes requests or consumes resources to prevent overload,...

beginner

Timeout Pattern

Prevent operations from hanging indefinitely by enforcing a maximum execution time. A resilience...

intermediate

Twin Pattern

Link two classes through mutual references so they delegate methods to each other: a...

advanced

Two-Level Cache Pattern

Combine an L1 in-memory cache with an L2 distributed cache to reduce latency for hot keys while...

intermediate

Type Object Pattern

Define game object types as runtime data rather than hard-coding them as classes, enabling...

No results found.