StackPractices

design

Practical resources about design for software engineers.

152 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.

beginner

Bridge Incompatible Interfaces with the Adapter Pattern

How to integrate legacy APIs, third-party libraries, and incompatible interfaces using object...

advanced

Scale Read and Write Workloads with CQRS

How to separate read and write models using Command Query Responsibility Segregation for optimized...

advanced

Model Complex Business Domains with Domain-Driven Design

How to structure code around business concepts using bounded contexts, aggregates, entities, value...

beginner

Create Objects Flexibly with the Factory Pattern

How to use factory methods, abstract factories, and dependency injection containers to decouple...

intermediate

Build Maintainable Applications with Hexagonal Architecture

How to structure applications using ports and adapters to isolate business logic from frameworks,...

beginner

Implement Reactive Systems with the Observer Pattern

How to build event-driven, reactive systems using the observer pattern with pub/sub, event...

beginner

Ensure a Single Instance with the Singleton Pattern

How to guarantee exactly one instance of a class exists in an application using lazy...

beginner

Swap Algorithms at Runtime with the Strategy Pattern

How to encapsulate interchangeable algorithms and behaviors using the strategy pattern with...

intermediate

Pipes and Filters Pattern: Composable Data Pipelines

Chain processing steps with independent filters connected by pipes. A pattern for data...

intermediate

Abstract Factory for Cross-Platform UI Component Families

Create families of related objects without specifying concrete classes, enabling platform-specific...

intermediate

Abstract Factory Pattern

Create families of related objects without specifying concrete classes. A creational design pattern...

beginner

Active Record Pattern

Wrap a database table or view in a class where an instance is tied to a single row, and the class...

beginner

Adapter Pattern

Convert the interface of a class into another interface clients expect. A structural design pattern...

beginner

Adapter Pattern for Integrating External REST APIs

Use the Adapter pattern to normalize responses from external REST APIs into a consistent internal...

advanced

Aggregate Pattern

Encapsulate a cluster of domain objects treated as a single unit for data changes. An Aggregate...

intermediate

Ambassador Pattern for Resilient Remote Service Access

Add a local ambassador that handles retries, circuit breaking, and monitoring when calling remote...

intermediate

Back-Pressure Pattern

Prevent upstream systems from overwhelming downstream consumers by propagating flow-control signals...

intermediate

Backend for Frontend (BFF) Pattern

Create dedicated backend services tailored to the specific needs of each frontend client type,...

advanced

Blackboard Pattern

A shared knowledge space where independent specialized modules collaborate to solve complex...

intermediate

Bridge Pattern: Decouple Abstraction from Implementation

Split a class into two hierarchies — abstraction and implementation — so both can evolve...

No results found.