Let’s work together

Tell me what you’re building and where you’d like help.

Or connect

Preview only. This form doesn’t send messages.

Back to writing

Before the code, draw the boundary

A few questions to ask before connecting another tool, automating another step, or giving a system more responsibility.

  • systems
  • engineering
In this article

A useful system has a clear boundary: what it is responsible for, what it needs from the outside, and what happens when those expectations are not met.

That boundary is worth drawing before choosing the tools. It helps turn “automate the process” into a decision someone can review.

Start with a concrete event

“Handle new inquiries” leaves a lot unsaid. Consider a narrower description:

When an inquiry arrives through the website, record it once, assign an owner, and make failures visible.

Now there is something to examine. We can name the input, the expected outcome, and the person who needs to know if the step fails.

It also makes the exclusions visible. Qualifying the customer, estimating the work, and accepting a contract are separate decisions. They may require different information and different owners.

Ask what crosses the boundary

Before building, write down four things:

  1. Input. What event starts the work, and which data can we trust?
  2. Output. What observable change counts as completion?
  3. Ownership. Who can resolve an exception or change the rule?
  4. Failure. How will someone notice that the expected change did not happen?

These questions apply to a function, a service, and a business workflow. The level of detail changes; the need for an explicit agreement remains.

Make retries part of the design

Suppose a form submission is delivered twice. Creating two customer records may be an easy technical outcome and a confusing operational one.

One approach is to attach a stable identifier to the submission and make duplicate processing safe:

record-inquiry.ts
type Inquiry = { submissionId: string; email: string };

async function recordInquiry(inquiry: Inquiry) {
  // The store must enforce uniqueness atomically.
  await store.insertIfAbsent(inquiry.submissionId, inquiry);
}

This is illustrative code, not a complete storage implementation. The important contract is that insertIfAbsent must make the uniqueness decision atomically. A separate “check, then insert” can still race when two requests arrive together.

The system boundary tells us where that promise belongs. It should live where the state is written, rather than depend on every caller remembering a convention.

Keep the first version small

A boundary is a working agreement, not a diagram to defend forever. New information may show that a responsibility belongs elsewhere.

The first version needs enough structure to make change understandable. It does not need to predict every future requirement.

A useful review question is: if this step stops working tomorrow, can someone find its owner, understand what should have happened, and recover without guessing?

If the answer is unclear, another integration is unlikely to make it clearer. Start by writing down the agreement.

For a related way to make those assumptions visible, see a place to think in public.