Design Patterns

Design patterns are standardised solutions to common software design problems. They represent best practices evolved over time, providing templates that allow developers to solve problems more efficiently and effectively.

Goal

The goal of using design patterns is to accelerate the development process by providing tested, proven development paradigms. Effective use of design patterns can result in code that is more reusable, scalable, and easier to understand and maintain.

Context

There are many different ways that code can be designed, each with different implications for system performance, security, and maintainability. By being aware of the different design patterns available, teams can choose the best for their context.

Patterns

PatternDescriptionUse CasesExamples
Focus on how instances of components or services are created and initialized.Useful for ensuring flexibility, testability, and scalability in object or service creation.Factory, Builder, Dependency Injection
Deal with combining or organizing components or modules.Useful for creating modular, reusable, and maintainable structures.Adapter, Composite, Facade, Layered Architecture
Define how components or systems communicate and delegate responsibilities.Useful for managing relationships, workflows, and data exchanges.Observer, Strategy, Mediator, Event-Driven Architecture
Address how systems manage tasks or resources in parallel processes.Useful for optimizing performance and ensuring consistency in distributed or multi-threaded systems.Producer-Consumer, Half-Sync/Half-Async, Circuit Breaker
Define how data is stored, retrieved, and manipulated across systems.Useful for organizing data flow and persistence in various architectures.Repository, Data Mapper, CQRS, Event Sourcing
Focus on the high-level organization of systems and their interactions.Useful for establishing overarching system structures and design principles.MVC, REST, Microservices, Hexagonal Architecture
Handle communication and coordination between different systems or components.Useful for ensuring interoperability and scalability in complex ecosystems.Publish-Subscribe, API Gateway, Message Broker

Inputs

ArtifactDescription
User StoriesDetailed descriptions of the functionality, performance criteria, and interfaces needed for each component.

Outputs

ArtifactDescriptionBenefits
Architectural Decision RecordsDocuments that capture the important architectural decisions made during the development process.Provides a record of the project's architectural history and rationale.

Anti-patterns

  • Over-Engineering: Applying design patterns where they are not needed, leading to unnecessary complexity.
  • Misapplication: Using a design pattern inappropriately, not aligned with its intended purpose.
  • Pattern Explosion: Employing too many different patterns within a project, causing confusion and maintenance difficulties.

Was this page helpful?

Previous
Designing the Feature
© ZeroBlockers, 2024. All rights reserved.