architect-handbook icon indicating copy to clipboard operation
architect-handbook copied to clipboard

Software Architect Handbook

Software Architect Handbook

UPDATE!: I will be updating this repository with a new structure that better supports Obsidian. This README won't be updated anymore and it will reference content from the /legacy folder. I'll iteratively move new versions of such content (and new stuff!) to ./READMEv2.md which will eventually become the main README and can be opened with Obsidian for better navigation.

What is software architecture?

  • Software Architect Handbook
    • System design
      • System Design - Case Studies
    • Design principles
    • Design patterns
      • Base patterns
      • System-level or architectural patterns
      • Gang of Four Patterns
      • Domain logic patterns
      • Data source & persistence patterns
      • Object relational patterns
        • Behavioral patterns
        • Structural patterns
        • Metadata mapping patterns
      • Web presentation patterns
      • Distribution patterns
      • Offline concurrency patterns
      • Session state patterns
      • Anti-Patterns
    • Architectural Styles & Patterns
      • Three-Layer System (Martin Fowler)
      • Service Oriented Architecture (SOA)
      • Ports & Adapters / Hexagonal
      • Clean Architecture
      • REST: Representational State Transfer
      • Flux & Redux
      • Domain-Driven Design
      • Microservices
    • Data storage
      • General concepts
        • Data Consistency
        • Data partitioning
      • Types
        • Relational Databases
        • Wide-column store
        • GraphQL
    • Software types
    • Operating systems
      • Linux
    • Refactoring & code smells
    • Programming paradigms
      • Structured programming
      • OOP: Object-oriented programming
      • Functional programming
    • Software Engineering Culture
      • Laws & Theorems
      • Working Methodologies
    • Testing
      • E2E Testing
    • General concepts
      • About system-design and architecture
      • About software engineering
      • Common jargon
    • Tooling - Language Agnostic
    • Technology specifics
      • Frontend

System design

For a complete System Design study, you should also be familiar with Databases related topics such as CAP Theorem. This section assumes prior knowledge about such topics, but you can also read about those in this very same repo.

  • Introduction
  • How to approach a design
  • Performance Measures
    • Response time
    • Responsiveness
    • Latency
    • Throughput
    • Load
    • Load sensitivity
    • Capacity
    • Scalability
  • Load Balancing
  • Sustainability
  • Scalability
    • Vertical Scaling (scale up/down)
    • Horizontal Scaling (scale out/in)
  • Caching
  • RAID
  • Consistency
  • Availability
    • Fail-over
    • Replication
  • Choosing a Database
  • CDN: Content Delivery Network
  • Stateless web tier
  • Multi-data center
  • Message Queue/Message Broker
    • Kafka
  • Logging, metrics, automation
  • Scaling from zero to millions of users
  • Back-of-the-envelope Estimation
  • A Framework for System Design Interviews
  • Hashing
    • The rehashing problem
    • Consistent hashing

System Design - Case Studies

Problems Solutions
Instagram News Feed - Gaurav Sen Solution
Key-value store Solution
Unique ID generator in distributed systems Solution
URL shortener Solution
Web crawler Solution
Notification system Solution
News feed system Solution
Chat system Solution
Search autocomplete system Solution
Youtube Solution
Google Drive Solution

Design principles

  • Common Architectural Principles
  • OO Design Principles
    • Encapsulate what varies
    • Program to an interface, not an implementation
    • Favor object composition over class inheritance
    • Strive for loosely coupled designs between objects that interact
    • Least Knowledge
  • DRY
  • GRASP
  • Hollywood Principle
  • SOLID
    • Single Responsibility Principle
    • Open Closed Principle
    • Liskov Substitution Principle
    • Interface Segregation Principle
    • Dependency Inversion Principle
  • KISS
  • WET
  • YAGNI

Design patterns

What is a design pattern?

Base patterns

  • Gateway
  • Mapper
  • Layer Supertype
  • Separated Interface
  • Registry
  • Value Object
    • Money
  • Special Case
  • Plugin
  • Service Stub
  • Record Set

System-level or architectural patterns

  • Event Sourcing
  • CQRS: Command and Query Responsibility Segregation
  • Saga: distributed transactions

Gang of Four Patterns

Please check the this repository for a detailed explanation and examples of each of the following patterns.

Creational Structural Behavioral
Abstract Factory Adapter Chain of Responsibility
Builder Bridge Command
Factory Method Composite Interpreter
Prototype Decorator Iterator
Singleton Facade Mediator
Flyweight Memento
Proxy Observer
State
Strategy
Template Method
Visitor

Domain logic patterns

  • Transaction Script
  • Domain Model
  • Table Module
  • Service Layer

Data source & persistence patterns

  • DAO: Data Access Object
  • Active Record
  • Data Mapper
  • Table Data Gateway
  • Row Data Gateway
  • Repository

Object relational patterns

Behavioral patterns

  • Unit of Work
  • Identity Map
  • Lazy Load

Structural patterns

  • Identity Field
  • Foreign Key Mapping
  • Association Table Mapping
  • Dependent Mapping
  • Embedded Value / Aggregate Mapping
  • Serializd LOB
  • Single Table Inheritance
  • Class Table Inheritance / Root-Leaf Mapping
  • Concrete Table Inheritance
  • Inheritance Mappers

Metadata mapping patterns

  • Metadata Mapping
  • Query Object
  • Repository

Web presentation patterns

What are web presentation patterns?

  • Application Model / Presentation Model
  • Humble View / Passive View
  • MVC: Model View Controller
  • MVP: Model View Presenter
  • MVVM: Model View View-Model
  • Front Controller
  • Page Controller
  • Supervising Controller
  • Template View
  • Transform View
  • Two Step View

Distribution patterns

  • Remote Facade
  • Data Transfer Object

Offline concurrency patterns

  • Optimistic Offline Lock
  • Pessimistic Offline Lock
  • Coarse-Grained Lock

Session state patterns

  • Client Session State
  • Server Session State
  • Database Session State

Anti-Patterns

What is an Anti-Pattern?

  • Abstraction Inversion

Architectural Styles & Patterns

Recommended book: https://en.wikipedia.org/wiki/Pattern-Oriented_Software_Architecture

Three-Layer System (Martin Fowler)

  • Three Fundamental Layers
  • Narratives summary
  • Other layering schemes

Service Oriented Architecture (SOA)

Ports & Adapters / Hexagonal

Clean Architecture

  • MVC and Hexagonal Architectures as Precursors
  • MVC Problems
  • Tradeoffs
  • What is Architecture
  • Keeping options open
  • Plugin Architecture - Model Controller Presenter (MCP)
  • Request and Response Models
  • Screaming Architecture
  • Testable Architecture
  • Humble Object Pattern
  • Services and boundaries
  • Test Boundaries
  • The Fragile Tests Problem
  • Code organization
    • Package by layer
    • Package by feature
    • Package by component
  • Target Hardware Bottleneck
  • The Missing Advice
  • Glossary
    • Details
    • Stable Abstractions Rule
    • Components
      • Concrete Components
      • Component Principles
        • Component Cohesion
          • Reuse/Release Equivalence Principle
          • Common Closure Principle
          • Common Reuse Principle
        • Component Coupling
          • Acyclic Dependencies Principle
          • Stable Dependencies Principle
          • Stable Abstractions Principle
    • Stability
    • Boundaries
    • Objects
      • Entities
      • Use Cases
      • Interactor
      • Interface Adapters
      • Presenter and View
      • Database Gateways
      • Main Component
    • Policy
    • Business Rules
    • Dependency Rule

REST: Representational State Transfer

Recommended reference: restfulapi.net

  • Introduction
  • History
  • Architectural Properties
    • Stateless vs Stateful
  • Architectural Constraints
  • Five key principles
  • Semantics of HTTP APIs

Flux & Redux

Domain-Driven Design

Overview

  • Aggregate
  • Bounded Context

Microservices

Overview

  • Benefits and alternatives
  • Coupling and Cohesion
  • Own their data
  • DDD - Mapping aggregates and bounded contexts
  • Monolith
  • Planning a Migration
  • Splitting the Monolith
    • Strangler Fig Application
    • UI Composition
    • Branch by Abstraction
    • Parallel Run
    • Decorating Collaborator
    • Change Data Capture
  • Decomposing the Database
    • Shared Database
    • Database View
    • Database Wrapping Service
    • Database-as-a-Service Interface
    • Aggregate Exposing Monolith
    • Change Data Ownership
    • Synchronize Data in Application
    • Tracer Write
  • Splitting Apart the Database
    • Split the Database First
      • Repository per Bounded Context
      • Database per Bounded Context
    • Split the Code First
      • Monolith as Data Access Layer
      • Multischema Storage
    • Schema Separation
      • Split Table
      • Move Foreign-Key Relationship to Code
    • Shared Static Data
    • Dealing with Transactions
      • Sagas
  • Growing Pains
  • Trade-Offs
  • When to avoid

Tools

Data storage

  • CAP/Brewer's Theorem
  • BASE
  • Object-oriented databases
  • Database Scaling
    • Vertical Scaling (Scaling Up)
    • Horizontal Scaling (Sharding)
  • Data Replication
  • Consistency Models
    • Strong Consistency vs Weak Consistency
    • Eventual Consistency
    • Strong Eventual Consistency (SEC)
  • Synchronization techniques
    • Quorum consensus
  • Handling failures
    • Failure detection
      • All-to-all multicasting
      • Gossip protocol
    • Handling temporary failures
      • Sloppy quorum
      • Hinted handoff
    • Handling performance failures
      • Anti-entropy protocol
    • Handling data center outage

General concepts

Data Consistency

  • Data consistency primer
  • Strong consistency
  • Eventual consistency
  • Inconsistency resolution
    • Versioning

Data partitioning

  • Data partitionioning primer
  • Horizontal partitioning (sharding)
    • Consistent hashing
  • Vertical partitioning
  • Fuctional partitioning

Types

Relational Databases

  • ACID: Atomicity, Consistency, Isolation, Durability
  • Isolation Levels
  • Transactions
  • Read Phenomena
  • 2PC Protocol / XA Transactions
  • Views
  • Joins
  • Stored Procedures
  • Indexing
  • ORM: Object-relational Mapping
  • Object-relational impedance mismatch

Wide-column store

GraphQL

  • Overview
  • Why use GraphQL?

Software types

Although some techniques and patterns are relevant for all kinds of software, many are relevant for only one particular branch.

  • Enterprise Applications
    • EAPPs Challenges
    • Kinds of EAPPs

Operating systems

  • Multithreading
  • Parallelism & Concurrency
  • Process & Thread
  • Models of Computation
    • Finite State Machine

Linux

  • Core principles
  • Components
  • File system

Refactoring & code smells

Programming paradigms

  • Imperative and Procedural
  • Declarative

Structured programming

What is structured programming?

  • Functional Decomposition
  • Structured Tests

OOP: Object-oriented programming

  • OOP Introduction
    • Objects and Classes
    • Class-based vs Prototype-based languages
  • Foundational concepts
    • 4 Pillars of OOP
      • Abstraction
      • Inheritance
      • Encapsulation
      • Polymorphism
    • Abstract Class
    • Mixin Class
    • Traits
    • Interface & Type
  • Techniques
    • Subtyping: Interface Inheritance
    • Composition, Aggregation and Delegation
      • Composition vs Inheritance
    • Parameterized Types
    • Dynamic Dispatch / Message Passing
    • OMT Notation & UML
  • Advanced concepts
    • Object-Oriented Design Principles
    • Gamma Design Patterns
    • The Power of Polymorphism: Dependency Inversion
    • Prototypal vs Classical Inheritance

Functional programming

What is functional programming?

  • Referentially Transparent (No Side Effects)
  • Immutability
  • Idempotence

Software Engineering Culture

  • Unix Philosophy
  • Software Engineering at Google
  • Success stories
  • Quotes

Laws & Theorems

  • 80/20 Rule
  • Beyoncé Rule: If you liked it, put a CI test
  • Churn Rule: Teams should internalize deprecation
  • Constantine's law: Favor high cohesion
  • Conway's law: Systems reflect organization's communication structure
  • Hyrum's Law: The Law of Implicit Dependencies
  • Occam's Razor: The simplest explanation
  • Pareto principle: The 80/20 rule

Working Methodologies

  • XP: Extreme Programming

Testing

E2E Testing

General concepts

About system-design and architecture

  • What is Software Architecture?
  • The Software Architect
  • The First Derivative
  • Evolutionary Design
  • Development Overconfidence
  • Is Quality Worth the Cost?
  • Concurrency
  • Distribution Strategies
  • Layering
  • Resilience vs Robustness

About software engineering

  • Developer Struggle
  • Mapping to Relational Databases
  • Organizing Domain Logic
  • Session State (stateful vs stateless sessions)
  • Technical Debt
  • Leaky Abstractions

Common jargon

  • Abstract Syntax Tree
  • CRUD
  • First-class citizen
  • Modularization
  • Side Effect
  • SPOF: Single Point of Failure
  • Web API

Tooling - Language Agnostic

  • Telepresence: tool that is aiming to make a hybrid local/remote developer workflow easier for Kubernetes users.
  • Pact: customer-driven contracts.

Technology specifics

Frontend

Frontend developer roadmap.

  • Atomic design
  • Design system
  • Legacy lifecycle of frontend
  • Areas of frontend
    • Backbone goals and OKRs
  • Accessibility testing
  • CSR vs SSR