# FOCUS Architecture — Front-Matter: Front matter - **Source**: /library/FOCUS Architecture/source-file.pdf - **PDF pages**: 1–12 - **Pages without text**: 1 --- FOCUS: Architecture for People Who Ship Software J.C. Ködel FOCUS: Architecture for People Who Ship Software 1. About the Author 1. The F12 test 2. The price of too many layers 3. The price of too few layers 4. Four pieces 5. Why now 6. Who looks for the rule now 7. Rosie’s Coffee Shop 8. Quick reference 2. Map of the trilogy 1. What each volume answers 2. Where this book fits 3. The Day One Line Change Broke Three Screens 1. The screen that started out reasonable 2. Coupling 3. Cohesion, the other side of the coin 4. The axis of change 5. Pitfalls 6. Quick reference 7. Exercises 4. AI Writes Fast. So What? 1. The twelve-minute coupon 2. The GitClear yardstick 3. Why the generator fails this way 4. Three guardrails against the same bug 5. So is AI the problem? 6. Pitfalls 7. Quick reference 8. Exercises 5. Simplicity Is a Decision: KISS and YAGNI 1. The engine nobody asked for 2. The four costs 3. Where the acronyms came from 4. The six lines the menu asks for 5. What YAGNI doesn’t cut 6. And when the need finally arrives? 7. Pitfalls 8. Quick reference 9. Exercises 6. DRY Isn’t About Code 1. Extraction by reflex 2. What Hunt and Thomas actually wrote 3. The inverse case: the card reader fee 4. Timing tools 5. The same knowledge outside the code 6. The critique: DRY as a coupling factory 7. Pitfalls 8. Quick reference 9. Exercises 7. SOLID Without Dogma 1. One tab, four bosses 2. Slice by actor, not by verb 3. Read the code through the OCP and LSP lenses 4. Narrow the contract and flip the arrow 5. What each principle charges whoever is looking 6. The cost of carrying what doesn’t matter 7. How many things you hold at once 8. The critique SOLID earned 9. Pitfalls 10. Quick reference 11. Exercises 8. Pure Functions and Immutability 1. Two totals for the same tab 2. Purity is what a function doesn’t do 3. Swap the call for the returned value 4. Freeze the data: immutability across ten languages 5. Functional core, imperative shell 6. Pitfalls 7. Quick reference 8. Exercises 9. Errors Are Values 1. The payment that only said “Something went wrong” 2. Expected error is not a defect 3. The failure becomes part of the return type 4. Three steps, two rails 5. Go’s counterpoint 6. Exceptions only at the boundary 7. Pitfalls 8. Quick reference 9. Exercises 0. Explicit Dependencies: DI and the Composition Root 1. The payment that fetched its own dependencies 2. Dependencies move up to the constructor 3. If nobody calls the locator, who builds the graph? 4. Pure DI before any container 5. The Python counterpoint: discipline instead of syntax 6. DI for the boundary, data for the rest 7. Pitfalls 8. Quick reference 9. Exercises 11. FOCUS in One Page 1. The handler that did everything 2. The path of a tap 3. The four pieces in the same gesture 4. The same slice in your language 5. Why just four 6. The recipe the orchestrator follows 7. Pitfalls 8. Quick reference 9. Exercises 2. Features, Not Layers 1. The change that touched four folders 2. The axis of change 3. The coffee shop in slices 4. Why it isn’t four folders 5. The whole slice at once 6. What the imports give away 7. The same slice in ten languages 8. shared/ is born empty 9. Pitfalls 10. Quick reference 11. Exercises 13. The View: Dumb by Design 1. The screen that calculates 2. The state that arrives ready 3. The same screen, now dumb 4. Does this belong in the View? 5. The critique: bloated state 6. Pitfalls 7. Quick reference 8. Exercises 4. The Orchestrator: Event In, State Out 1. Where the one-way flow came from 2. The anti-solution: the orchestrator that decides 3. Events and states as sealed classes 4. The complete orchestrator 5. Go’s counterpoint: no unions, no billing 6. The flow test: event on top, states below 7. Transient context and persistent context 8. The criticism: boilerplate and rules in the reducer 9. Pitfalls 10. Quick reference 11. Exercises 15. Use Cases: Where the Rules Live 1. The anti-solution: the same rule in three places 2. The rule as a pure function: the signature first 3. The same rule, ten languages 4. Orchestrator fetches, use case decides 5. The use case as a retrieval unit 6. Testing without a single test double 7. The critique: “where’s the use case’s interface?” 8. Pitfalls 9. Quick reference 10. Exercises 6. Repositories: The Exception Boundary 1. The anti-solution: the copied catch in every screen 2. The repository’s contract comes before its body 3. The single translation: one catch, and only one 4. The lookup feeding the orchestrator 5. The same boundary in ten languages 6. Where reading can stop 7. Contracts that age slowly 8. The critique: the generic repository and “the ORM already does this” 9. Preview of the fake: the interface you’ll thank in chapter 17 10. Pitfalls 11. Quick reference 12. Exercises 17. Commands and Queries: CQS Without Ceremony 1. The anti-solution: paying and asking in the same gesture 2. CQS: Meyer’s rule 3. The split, in all ten languages 4. The canonical table’s two tracks 5. From CQS to CQRS, and where FOCUS stops 6. Classify the eight operations 7. Pitfalls 8. Quick reference 9. Exercises 8. Test Each Piece the Way It Asks to Be Tested 1. The anti-solution: the suite that asserts the how 2. Use case: a pure test, no double at all 3. Repository: the fake you already have 4. Orchestrator: flow test 5. View and integration: where each one pays its own cost 6. The two critiques 7. Pitfalls 8. Quick reference 9. Exercises 9. What to Do When the Language Doesn’t Help 1. The slice on the board 2. Types first: four families and one warning 3. The three anchors, family by family 4. When the language doesn’t help 5. The critiques, with a ruler instead of rhetoric 6. The equivalence table: porting to the 11th language 7. Pitfalls 8. Quick reference 9. Exercises 0. Anti-Patterns: How to Wreck FOCUS 1. The shape of the card 2. Card 1: business rule in the orchestrator 3. Card 2: use case that hits the database 4. Card 3: generic repository 5. Card 4: layer by ceremony 6. Card 5: domain try/catch 7. Card 6: premature shared/ 8. What Go won’t let you do 9. Pitfalls 10. Quick reference 11. Exercises 21. Migrate Legacy Code Without Stopping the Factory 1. The fig that strangles 2. Choose the first slice: frequency times pain 3. Step 1: fence the behavior with a characterization test 4. Step 2: extract the rule into a pure use case 5. Step 3: wrap the legacy in an adapter 6. Step 4: wire the new view to the orchestrator 7. When NOT to migrate 8. Both worlds on the same counter 9. Pitfalls 10. Quick reference 11. Exercises 2. FOCUS + AI: The Duo That Scales 1. The one-sentence request 2. Each piece against a number 3. The spec says what, the architecture says where 4. Anatomy of the architectural prompt 5. The same feature under the prompt 6. Slice-guided review 7. Two criticisms I take seriously 8. Pitfalls 9. Quick reference 10. Exercises 3. Architecture for humans and for models 1. The pattern nobody designed on purpose 2. The name for this 3. The question left over 4. Build Rosie’s App 1. The focus-coffee repository 2. Menu: the read-only slice 3. Tab: the slice with a lifecycle 4. Payment: the slice of errors 5. Loyalty: the rule, and the first shared/ 6. Porting roadmap 7. The critique: “book examples always work” 8. Pitfalls 9. Quick reference 10. Exercises 5. Ship Increments Without Chaos 1. FOCUS in a hallway conversation 2. Who benefits (and it’s a single reason) 3. The ruler against drift 4. Quick reference 5. Exercises