Build The Seam On Day One

Building a platform for high-volume data forces a choice.

You need a fast database for long-term storage. But setting up a complex system on day one is hard. You might not even know your data patterns yet. The safe choice is a standard relational database you already use.

The mistake is tying your code directly to that first database. If every part of your app calls the database directly, you create a trap. Switching to a better database later will require a massive refactor.

The right move is to build a seam.

A seam is a contract. It defines what the system does without saying how it does it.

  • Create an interface for the task.
  • Write a basic driver using your current database.
  • Bind that driver to the interface.

Every other part of your app talks only to the interface. No one knows which database is running in the background.

When your data grows and you need a faster system, the work is simple. You write a new driver, change one line of code, and ship it. No dashboards break. No pipelines stop.

Some people call this premature abstraction. They say you do not need it yet.

I disagree. An interface costs you one extra file. Skipping it just moves the cost to a later date. When you finally need to change, you will have hundreds of files to fix under pressure. An interface is cheap insurance.

Use these three habits to make your seams stronger:

  • Use dual identifiers. Use fast integers for internal database joins. Use UUIDs for anything that leaves your system. This keeps your data secure and your joins fast.

  • Use Enums for shared vocabulary. Do not use random strings for statuses or severities. Use a single Enum so every part of your app speaks the same language.

  • Use versioned envelopes for data. If your system receives data from many sources, use a strict schema. Only add new fields. Never remove or rename them without a new version. This keeps old clients working while you improve the system.

Find the boundary. Name it with a contract. Fill it with a simple implementation.

The contract is your promise. The driver is just how you keep that promise today.

Source: https://dev.to/nasrulhazim/build-the-seam-on-day-one-the-second-driver-on-day-ninety-26b