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.

intermediate

Builder Pattern: Step-by-Step Object Construction

Construct complex objects step by step. A creational design pattern for readable, configurable...

intermediate

Business Delegate Pattern

Reduce coupling between presentation and business tiers by introducing an intermediary that handles...

beginner

Cache-Aside Pattern

Load data into the cache on demand from the backing store. A caching pattern that gives the...

intermediate

Cache Invalidation Pattern

Strategies for keeping cached data fresh: TTL expiration, explicit invalidation, write-through, and...

advanced

Cache Stampede Prevention Pattern

Prevent thundering herd cache misses with locks, single-flight, stale-while-revalidate and early...

intermediate

Chain of Responsibility for Request Processing Middleware

Pass requests along a chain of handlers where each handler decides whether to process the request...

intermediate

Chain of Responsibility Pattern

Pass requests along a chain of handlers until one handles it. A behavioral design pattern for...

intermediate

Circuit Breaker Pattern in Python, JavaScript, and Java

Prevent cascading failures by stopping requests to failing services. An architectural pattern for...

intermediate

Claim Check Pattern

Store large payloads in external storage and pass a lightweight claim token through the message...

intermediate

Command Pattern: Examples in Python, Java & JavaScript

Encapsulate a request as an object so you can queue, log, and undo operations. Command pattern with...

intermediate

Command Pattern with Undo/Redo in TypeScript

Implement the Command pattern to encapsulate requests as objects, enabling undo/redo operations,...

advanced

Compensating Transaction Pattern

Undo the effects of a completed transaction by executing a counter-operation, enabling eventual...

intermediate

Composite Entity Pattern

Map a coarse-grained entity to multiple database tables by composing dependent objects, so the...

intermediate

Composite Pattern

Compose objects into tree structures to represent part-whole hierarchies. A structural design...

intermediate

Composite Pattern for UI Component Trees in React

Use the Composite pattern to compose objects into tree structures, letting clients treat individual...

beginner

Content Delivery Network (CDN) Pattern

Distribute static and live content through geographically dispersed edge servers to reduce latency,...

intermediate

Context Object Pattern: Examples

Reduce parameter bloat by passing a single context object through the call chain. Examples in...

advanced

CQRS Pattern

Separate read and write models to optimize each for its own workload — when CQRS pays off, when...

beginner

Data Access Object (DAO) Pattern

Abstract and encapsulate all access to a data source by exposing a clean interface while hiding...

intermediate

Data Mapper Pattern: Keep Domain Models DB-Free

Separate in-memory domain objects from the database by delegating persistence to a dedicated mapper...

No results found.