Domain Re discovery Patterns for Legacy Code
summary
Performs a three‑week health check on a 4 million‑line codebase to rediscover domain by building a code map (lines, cyclomatic complexity, churn) and mapping git temporal coupling to reveal hidden dependencies. Extracts humble controller classes, defines ports as interfaces, and adds characterization tests (approval‑style snapshots) plus an integration DSL that lets tests remain stable while constructors and internals change. Uses ArcUnit rules to freeze architectural constraints. Tooling (CodeCarter, git metrics) and these steps reduce unpredictability and expose domain models that become testable and refactorable.
AI-written summary · about
chapters (14)
- 0:00🚀 Build Stuff Conference – Get Your Tickets!
- 0:30Introduction: Legacy Code and the Need for Rediscovery Patterns
- 3:00Domain Rediscovery: Understanding the Code's Intentions
- 6:00Pattern 1: Creating a Code Map to Visualize Complexity
- 9:20Pattern 2: Starting at the Edge with Controllers
- 12:00Making Controllers Humble and Extracting Logic
- 15:30Testing: Characterization Tests for Legacy Code
- 18:40How to Manage Refactoring and Avoid Redundant Tests
- 22:13Using Abstraction Layers for Cleaner Testing
- 25:00Handling Dependencies and Coupling in Legacy Code
- 28:10The Importance of Correcting Conventions to Improve Code
- 32:00Managing Complexity: Using Tools like Code Cartter
- 35:00The Role of Predictability and Structured Refactoring
- 38:30Conclusion: How Domain Rediscovery Improves Legacy Code
related talks
38mDomain-Driven Transformation - how to improve the structure of legacy systems
48mDomain Pattern – How the Domain Influences the Architecture
51mDomain - Driven Transformation
49mTreat Your Code as a Crime Scene
54mResolving technical debts in software architecture
41mDomain Experiments
44mDependencies; Devil or Darling?
37mStart with DDD when you have a monolith
