Overview
Architecture patterns and methodologies provide structured approaches to designing complex software systems. This section covers fundamental architectural frameworks that help organize system components, manage complexity, and communicate design decisions effectively.
๐งญ Software Architecture vs. System Design
This section is about software architecture โ the structure inside a single application (or service). Patterns here organize classes, modules, layers, and code-level concerns: SOLID, layered architecture, hexagonal/clean architecture, DDD building blocks, GoF design patterns, FSMs.
The sibling System Design section covers a different layer: how multiple services, databases, caches, and queues interact across machines and regions โ load balancing, sharding, CAP theorem, sagas, microservices, multi-region deployments.
Both disciplines complement each other. An e-commerce monolith primarily needs software architecture; a multi-region payment platform needs both. Use this section for in-app structure; cross to System Design when the scope expands beyond one service.
๐ฏ What You'll Learn
This section explores proven architectural methodologies used in modern software engineering:
- By Example (umbrella): 93 heavily annotated examples โ 85 canonical + 5 FP-native extras (#86โ90: ROP, Free Monads / Tagless Final, Reader, Kleisli, State) + 3 OOP-native extras (#91โ93: Active Record, GRASP, Singleton-with-FP-counterexample). Available in three paradigm tracks with explicit paradigm-fit framing (Norvig/Seemann/Wlaschin/Hickey/Evans/Fowler/Pike citations):
- OOP โ Java, Kotlin, C#, TypeScript (inheritance-bearing class hierarchies)
- FP โ F#, Clojure, TypeScript, Haskell (ADTs, HOFs, Railway-Oriented Programming) โ Rust also appears where the FP idiom translates one-to-one
- Procedural (new) โ Go (canonical), Rust, C (sidebar) โ composition + structural typing + explicit data flow, without inheritance hierarchies. Authority: Pike (Go at Google, 2012); Boyle (Domain-Driven Design with Golang, 2022); Hoverbear (Pretty State Machine Patterns in Rust); Samek (Practical UML Statecharts in C/C++)
- C4 Model: Hierarchical approach to visualizing software architecture at multiple levels of abstraction (Context, Containers, Components, Code)
- Domain-Driven Design (DDD): Strategic and tactical patterns for modeling complex business domains and organizing code around business concepts
- Hexagonal Architecture: Ports-and-adapters approach that isolates the domain core from external concerns (databases, frameworks, UIs)
- Finite State Machine (FSM): Mathematical model for designing systems with discrete states and well-defined transitions
- Cases: Production wiring tutorials that compose C4, DDD, Hexagonal Architecture, and FSM in real-world code (In FP and In OOP cases)
๐ Why Architecture Patterns Matter
Good architecture provides:
- Clarity: Clear structure makes systems easier to understand and maintain
- Communication: Shared vocabulary for discussing design decisions with teams
- Scalability: Proven patterns that support system growth and evolution
- Quality: Built-in best practices reduce bugs and technical debt
- Flexibility: Modular design enables easier changes and feature additions
๐๏ธ When to Use Each Pattern
C4 Model:
- Documenting system architecture for stakeholders at different technical levels
- Creating visual diagrams that balance detail with comprehension
- Onboarding new team members to existing systems
Domain-Driven Design:
- Complex business domains with rich behavior and business rules
- Large systems requiring clear boundaries and modular organization
- Teams needing shared language between developers and domain experts
Finite State Machine:
- Systems with clearly defined states (order processing, authentication flows, game logic)
- Workflow management and business process automation
- Protocol implementations and parsing
๐ Architecture-First, Technology-Second
These patterns are technology-agnostic:
- Apply to any programming language (Java, Go, Python, TypeScript, etc.)
- Work with any framework or technology stack
- Focus on structural organization, not implementation details
- Principles remain constant as technologies evolve
๐ What's Included
Each architecture pattern section covers:
- Core Concepts: Fundamental principles and terminology
- When to Use: Scenarios where the pattern excels
- Key Components: Main building blocks and their relationships
- Best Practices: Proven approaches for successful implementation
- Common Pitfalls: Mistakes to avoid and how to address them
- Real-World Examples: Practical applications in production systems
๐ Related Content
- System Design Cases - See these patterns applied in real-world system designs
Production Wiring
After the by-example tutorials for C4, DDD, Hexagonal Architecture, and FSM, the production cases show how the four families compose in real production code:
- Next step (production wiring): In FP โ F# / Giraffe / Npgsql, Clojure / Ring / next.jdbc, TypeScript / Hono / node-postgres, Haskell / Servant / postgresql-simple
- Next step (production wiring): In OOP โ Java / Spring Boot 4, Kotlin / Spring Boot 4, C# / ASP.NET Core, TypeScript / NestJS
- Next step (production wiring): In Procedural โ Go / chi / database/sql, Rust / axum / sqlx
๐ Getting Started
Start with the pattern that best matches your current needs:
- New to architecture? Begin with C4 Model for visualization fundamentals
- Complex business domain? Explore Domain-Driven Design for domain modeling
- State-driven systems? Study Finite State Machine for state management
Each pattern complements the others - they're tools in your architectural toolkit, not mutually exclusive choices.
Last updated January 29, 2026