What is Software Architecture?

The big decisions about how a codebase is organized and how its pieces fit together.

What is it?

Before anyone builds a house, someone decides the big things: how many floors, where the plumbing runs, which walls hold up the roof. Get those wrong and no paint can fix it. You'd have to tear out walls.

Software has the same two levels. Writing a function or naming a variable is like picking the paint. The bigger decisions come first:

  • How is the codebase split into folders and modules?
  • Which parts may talk to which?
  • Where does data enter the system, and where is it stored?
  • How do we add a feature next year without rewriting everything?

Those structural decisions, which are expensive to change and shape everything built on top, are software architecture. It's not a tool or a diagram. It's the set of choices that let a system be built, understood, changed, and grown.

A simple test: a coding decision is easy to undo (rename a variable, refactor one function). An architectural decision is expensive to undo (split one codebase into many services, or change how every feature is laid out).

Explain like I'm 10

A city planner deciding where roads, water lines, and zoning go is doing architecture. A homeowner placing a bookshelf is not, even though both decide things about the same city.

Examples

A structural decision vs. a coding decision

// Coding decision: easy to change later, low risk
function formatPrice(cents) {
  return "
quot; + (cents / 100).toFixed(2); } // Architectural decision: hard to change later, high risk // "All database access goes through a data-access layer. // No other part of the app is allowed to write SQL directly."

Renaming formatPrice takes five minutes. Reversing the database rule after fifty files write their own SQL could take weeks.

The same feature, two different structures

// Structure A: everything in one file
// order.js handles validation, pricing, saving to DB, and sending email

// Structure B: split by responsibility
// validateOrder.js
// calculatePrice.js
// saveOrder.js
// sendConfirmationEmail.js

Both structures can deliver the same feature. Choosing between them is architectural: it doesn't change what the app does, only how easy it is to change, test, and understand.

How it works

Architecture isn't something you produce once. It's a set of ongoing decisions and constraints:

- Boundaries: which parts of the code may know about which others. - Structure: how the codebase is split into folders, modules, or services. - Data flow: where information enters, how it moves, and where it ends up. - Consistency: shared conventions that let any engineer guess where logic lives before opening the folder.

You can't see these in any single function, only in the codebase as a whole. That's why architecture is a separate skill from writing code.

Why does it exist?

Without structural decisions, a codebase grows into whatever shape is fastest in the moment, which is rarely easy to work with a year later.

The real cost of a codebase isn't "does it work today" but "how much does every future change cost." Good early decisions keep that cost low. Bad ones, or none, compound until every small feature means understanding (and risking) everything else.

When to use it

All software has some architecture, even if nobody chose it. A 200-line script still has an implicit structure. So the question is whether to make those decisions on purpose.

Do it deliberately once a codebase will have more than one contributor, live longer than a few weeks, or grow too big to hold in your head.

When not to use it

For a one-off script or a throwaway weekend prototype, designing layers and boundaries is wasted effort. Quick and messy is fine, even correct, when the code is disposable. The skill is knowing which case you're in.

Common mistakes

  • Treating architecture as something only senior engineers or diagram tools produce, when every contributor makes and reinforces these decisions daily.

  • Confusing architecture with technology choices ("we use React"). The framework is a detail; how you organize logic around it is the architecture.

  • Over-architecting a throwaway script, or under-architecting a system that will clearly grow. Both come from not asking 'how long will this live, and who else will touch it?'

Practice exercises

  1. Easy:

    In two sentences, explain the difference between a 'coding decision' and an 'architectural decision'. Give an example of each from your own project.

  2. Medium:

    Take a small script you've written (or imagine one that reads a CSV, transforms it, and writes a report). List three structural decisions you made, even ones you didn't notice at the time.

  3. Hard:

    Describe a real or imagined codebase with no deliberate architecture. Explain concretely what went wrong (e.g., a one-hour change took a week).

Interview questions

How would you explain software architecture to someone new to the field?

It's the set of big, structural decisions about how a codebase is organized and how its parts interact. They're expensive to change later, unlike everyday coding decisions, which are cheap to change.

Does every piece of software have an architecture, even a small script?

Yes. Even an unstructured script has an implicit structure (e.g., everything in one file, in one order). Architecture as a discipline means making those decisions on purpose, not by accident.

How is an architectural decision different from an everyday coding decision?

An architectural decision is expensive and risky to reverse once other code depends on it (e.g., how modules may talk to each other). A coding decision, like a variable name or one function's implementation, is cheap and low-risk to change.

What actually makes an architectural decision 'expensive' to reverse, mechanically?

How much depends on it. Nothing but its own function depends on a variable name. Every later feature depends on a rule like 'all database access goes through one layer', so undoing it means finding and rewriting every place that assumed it.

Is software architecture the same thing as choosing a framework or technology stack?

No. Picking React or Postgres is a technology choice, often reversible with effort. Architecture is how you organize logic around that technology: the boundaries, layers, and data flow. A bad architecture on a great framework is still bad.

What's a practical heuristic for telling whether a decision you're about to make is architectural?

Ask how much would need to change if you reversed it next month. 'Just this function' means a coding decision. 'Every feature that touched this area since' means it's architectural.

Is architecture something you decide once at the start of a project and then move on from?

No. It's an ongoing set of decisions that every pull request reinforces or erodes. A codebase's architecture in year two is the sum of every structural choice along the way, not just the day-one whiteboard.

What goes wrong when a team treats architecture as something only senior engineers do?

Everyone still makes structural decisions daily, like where to put a new module or whether to call another layer directly. If only seniors are expected to think about it, those decisions get made without discipline, and the architecture erodes one convenient shortcut at a time.

Can you give an example of over-architecting, and explain why it's a real cost even if the code works?

Building a plugin system with several abstraction layers for a script that only ever runs one fixed way. It works, but every reader must trace through interfaces and indirection for flexibility the project will never use. That's an ongoing comprehension cost for a benefit that never arrives.

Can you give an example of under-architecting, and what symptom would show up in the codebase?

A growing app where every screen's component queries the database directly. The symptom: one schema change means touching dozens of unrelated UI files, and nobody can predict what a change will break, because no boundary contains the effect.

How would you decide whether a two-week prototype needs deliberate architecture?

Ask whether it will be thrown away or become the real product. If it's truly disposable, layers and boundaries are wasted effort. If it may live on (prototypes often do), make at least the cheapest structural decisions, like keeping concerns separated, from the start.

Two teams build the exact same feature with different internal structures. Are both making architectural decisions?

Yes. Architecture isn't about what the software does (both shipped identical behavior) but how the code is organized to produce it. That structural choice is the architecture, even if users never see it.

What's the relationship between architecture and the total cost of a system over its lifetime?

Architecture sets the cost of every future change, not just the first build. A system built fast with no structure may look cheaper on day one. But if every later feature means understanding and risking the whole codebase, it costs far more over the years than one with deliberate boundaries.

Why do boundaries — who's allowed to call whom — matter more than which specific technologies are used?

Boundaries control blast radius: how far a change's effect can spread. You can usually swap technologies behind a boundary without touching the rest. Without boundaries, no technology choice will contain a bad change.

How does architecture show up differently in a 200-line script versus a codebase worked on by 50 engineers?

In a 200-line script, the architecture may just be the order statements run in. That's implicit and low-stakes, since one person holds it all in their head. With 50 engineers, nobody can hold the whole system, so explicit boundaries and conventions are the only way people can predict where logic lives and change it safely.

What's a red flag in a pull request that suggests an architectural decision is being made informally?

A change that quietly adds a new way for one part to reach into another, like a UI component importing a database client 'just this once'. It looks like a small local fix, but it sets a precedent other changes will copy.

If you joined a new team, how would you go about learning the architecture of an existing codebase?

Look for the real boundaries, not a diagram: which modules are only imported in one direction, where business rules actually live versus where they should, and what a typical feature touches. Reading a few real pull requests often shows the lived architecture faster than any document.

Why might a technically correct implementation still represent bad architecture?

'Correct' only measures whether today's output matches the requirement. Architecture is judged by how well the system absorbs the next change. A correct feature built by copy-pasting business logic into five files is bad architecture, because the next change to that logic must be made five times.