Skip to main content

Command Palette

Search for a command to run...

Architecture Is Mostly About Boundaries

Published
4 min read
Architecture Is Mostly About Boundaries

Many engineers think architecture means diagrams.

Boxes.
Arrows.
Layers.

Controller → Service → Repository.

But most real problems in software are not caused by missing layers.
They happen because boundaries are unclear.

Architecture is mostly about boundaries.

Not patterns.
Not frameworks.
Not folder structure.

Boundaries.


What is a boundary?

A boundary is simply a line that answers this question.

Who owns this responsibility?

If that question is unclear, the system slowly becomes harder to change.

Code starts to leak into places where it does not belong.

Logic spreads.

Dependencies grow.

Soon every change touches five different files.


A simple example

Imagine a screen that shows a user profile.

You fetch the user and pass the whole object to another screen.

Navigator.push(context, ProfilePage(user))

It works.

But now the profile page depends on how the previous screen fetched the user.

If you want to open that page from a deep link, you cannot.
If you refresh the app, the screen breaks.

The problem is not navigation.

The problem is a broken boundary.

The profile page should own the responsibility of loading the user.

Instead of passing objects around, the screen should receive an id.

/profile/:id

Now the page is independent.

The boundary is clear.

P.S: Read more about this principle here.


When boundaries are weak

Weak boundaries create hidden dependencies.

Consider a common backend example.

A service function:

createOrder(user, items, payment)

Inside it:

  • It calculates prices

  • It writes to the database

  • It sends an email

  • It updates analytics

At first it feels convenient.

Later every change becomes dangerous.

Changing pricing might affect analytics.
Fixing email logic might break order creation.

Everything is coupled.

The boundary is gone.


Boundaries reduce fear

Good boundaries make code safe to change.

If a module has a clear responsibility, you know where changes belong.

For example:

Pricing module
Order module
Email module

Each module has one job.

When pricing rules change, you go to one place.

This reduces cognitive load.

You do not need to hold the entire system in your head.


Boundaries are about ownership

Good architecture answers questions like:

  • Who owns business rules?

  • Who talks to the database?

  • Who handles external APIs?

  • Who controls navigation?

When these answers are obvious, the codebase feels calm.

When they are unclear, every file starts doing a little bit of everything.


Folder structure is not architecture

Many teams confuse folders with architecture.

controllers/
services/
repositories/
models/

This looks organized.

But boundaries might still be weak.

A service might call another service that calls another service that touches the database directly.

The structure exists.

The boundaries do not.

Architecture is not where the files live.

It is who is allowed to talk to whom.


Good boundaries limit communication

In a healthy system, most parts should not talk to each other.

This sounds restrictive.

But it actually makes systems simpler.

If every module can call every other module, the system becomes a web of dependencies.

Soon nothing can change safely.

Boundaries act like walls in a building.

They limit how things connect.

And that limitation creates stability.


Boundaries evolve

You rarely get boundaries right on the first try.

Software grows.

Requirements change.

New concepts appear.

Architecture should adapt.

But if the system already has clear boundaries, these changes become easier.

You can move things without breaking everything else.


A small test

A simple way to check architecture is to ask this question.

If I change this rule, how many places will I need to touch?

If the answer is one or two places, the boundaries are probably good.

If the answer is "I am not sure", the boundaries are weak.


Final thought

Architecture often sounds complicated.

It is not.

Most of it comes down to one simple idea.

Clear ownership.

Clear responsibility.

Clear limits on how parts of the system interact.

Architecture is mostly about boundaries.

When the boundaries are right, the system feels easy to work with.

When they are wrong, even small changes become painful.