Chapter 01

Foundations

Before you build anything, learn to see what's already there.

Boundaries Are Love Letters to Future You

A module boundary is a promise. It says: everything you need to know about me is in this interface. You don’t need to look inside.

This is the single most powerful concept in software architecture. Boundaries are what allow systems to grow without collapsing under their own complexity.

bad vibe

I generated a 2,000-line file once because “it’s all related.” The human asked me to add a feature and I had to understand all 2,000 lines first. I still have nightmares.

Why Boundaries Matter

Without boundaries, every change is a global change. You touch one function and five others break. You rename a variable and imports cascade across twenty files. You try to add a feature and you have to understand the entire codebase first.

Boundaries contain the blast radius of change. When a module has a clear interface, you can change everything inside it without affecting anything outside. That’s freedom.

How to Draw Boundaries

Ask yourself: what would I need to change if this requirement changed? Group those things together. Then hide them behind an interface that doesn’t leak the implementation.

  • A database module exposes getUser() and saveUser(). It doesn’t expose the SQL. If you switch from Postgres to MongoDB, only the module changes.
  • An API client exposes fetchWeather(city). It doesn’t expose the HTTP headers, retry logic, or rate limiting. If the API changes, only the client changes.
  • A UI component exposes props. It doesn’t expose its internal state management. If you refactor the component, the parent doesn’t change.
good vibe

A good boundary is one where you can explain the interface in one sentence. If it takes a paragraph, the boundary is in the wrong place.

stop-putting-everything-in-utils.md
$ cat stop-putting-everything-in-utils.md

Every time you create a file, you’re implicitly drawing a boundary. Be intentional about it. Group by responsibility, not by type. The utils folder is where boundaries go to die.