Skip to content

11 · Refactor toward insight

When you finish this lesson you should be able to:

  • Start a modeling improvement from a real pain, not from boredom with the folders
  • Use a small exploration group, then bring the language back to the whole team
  • Time refactors to follow insight (and incidents), not to fill idle weeks
  • Treat crisis as a chance to name the implicit rule while everyone still cares

You now have building blocks, implicit→explicit, and supple design. None of it happens as a one-person aesthetic pass. Evans’s chapter 13 is about how a team gets there.

Refactor toward insight starts when:

  • a scenario is painful to walk
  • experts and developers keep talking past each other
  • a new feature has nowhere to sit (lesson 07’s “allocation checking” moment)

It does not start because someone wants to rename utils on a Friday. Drive-by renaming without experts forks the language (lesson 02).

A few people (developer + expert, sometimes two developers) take a spike: try a deeper model on a vertical slice. They are allowed to be wrong. They come back with names and a demo, not a 20-page design.

If the exploration never reintegrates, you have a skunkworks dialect. Continuous integration inside the bounded context (lesson 12) still applies.

Look at analysis patterns (lesson 10), the domain’s books, last year’s incident write-ups. Do not explore in a cultural vacuum. Also do not import a pattern the experts do not speak.

The target is a model developers like to use (supple) and experts recognize. If only one group is happy, you are not done. Hands-on modelers (lesson 03) are the bridge.

  • Too early: you do not know the contours; you will invent a framework.
  • Too late: the implicit model is in 400 conditionals; every change is a campaign.
  • Good: after a walk failed, after a breakthrough, after an incident named a rule.

Little refactors continuously; model refactors when you have a hypothesis and an expert.

Production is where implicit rules surface: “we never send two receipts.” Capture it that week as a concept (Delivery identity, Specification). Waiting three sprints loses the energy and the witnesses.

  1. One modeling hour with an expert on a painful scenario.
  2. A spike bounded to a day.
  3. A rename + tests in the core module.
  4. A demo that uses the new sentence in the ubiquitous language.

If your “DDD adoption” is only a shared kernel of base classes, you skipped this chapter.

  1. Name the last incident or the last feature that had “nowhere to sit.”
  2. Write the implicit rule in expert speech.
  3. Who would be on a two-person exploration? (roles, not a crowd)
  4. What is the Friday artifact (a type, a test, a deleted flag)?
  5. What you will not do (rewrite the platform, add a rules engine, rename everything).
  • Domain-Driven Design — Chapter 13, Refactoring Toward Deeper Insight