Skip to main content

Chapter 15: What Is Architecture?

"The primary purpose of architecture is to support the life cycle of the system. Good architecture makes the system easy to understand, easy to develop, easy to maintain, and easy to deploy."

๐ŸŽ“ For New Learnersโ€‹

Architecture Is Shapeโ€‹

Software architecture is the shape of the system โ€” how it is divided into components, how those components are arranged, and how they communicate. The architect is the person who makes these "big" decisions.

But as Chapter 1 established, there is no clear line between architecture and design. The decisions at every level โ€” from the system's top-level component structure down to the naming of a function โ€” are all part of the same continuum.

The Goal of Architectureโ€‹

The goal is not "choose the right framework" or "implement the right pattern." The goal is:

Support the life cycle of the system โ€” make it easy to understand, develop, maintain, and deploy โ€” while preserving as many future options as possible.

Good architecture maximizes the number of decisions NOT made. The longer you can defer deciding whether to use MySQL or MongoDB, whether to build microservices or a monolith, the more information you'll have when you finally decide โ€” and the cheaper the decision becomes.

Architecture vs. Behaviorโ€‹

The system's behavior (what it does) is only one concern. Architecture (how it is structured) is separate. A system can behave correctly and be architecturally terrible. A system can be beautifully structured and not yet fully functional.

The architect's job is to ensure the system can remain changeable while continuing to behave correctly.

What Architecture Is NOTโ€‹

  • It is not "use microservices"
  • It is not "use hexagonal architecture"
  • It is not "use Spring Boot"
  • It is not "use Kubernetes"

These are implementation choices. Architecture is the principles and boundaries that make the system adaptable โ€” the specific tools are details to be deferred.


๐Ÿ”ฌ Senior Deep Diveโ€‹

Deferring Decisions: The Option Value of Architectureโ€‹

Martin introduces the concept that good architecture preserves options. This is the architectural equivalent of financial option value:

Every irreversible decision made early is a commitment made with incomplete information. The cost of bad early decisions compounds over time.

Examples of decisions that can (and should) be deferred:

  • Database: Design around a repository interface. Choose MySQL, PostgreSQL, or DynamoDB later โ€” after you understand the access patterns.
  • Message broker: Design around an event publisher interface. Choose Kafka, RabbitMQ, or SQS later โ€” after you understand the throughput requirements.
  • Deployment topology: Start as a monolith. Extract to microservices later โ€” after you understand the team structure and service boundaries.
// Deferred decision: which database?
public interface OrderRepository {
Optional<Order> findById(OrderId id);
void save(Order order);
}

// Today: in-memory (for early development)
// Month 3: PostgreSQL via JPA
// Month 12: read from read replica, write to primary
// The use case never changes.

Supporting Development, Deployment, Maintenanceโ€‹

A good architecture must serve four life-cycle concerns:

Development: Small teams don't need complex component structures. But as teams grow, the architecture must allow parallel development without constant merge conflicts โ€” which means clear boundaries and ownership.

Deployment: The architecture should minimize the number of things that must be deployed together. Ideally: deploy each component independently. In practice: start as a deployable monolith, evolve toward independent deployment as needed.

Operation: Good architecture makes operational needs obvious. A system that needs high throughput should make its data flows clear. Scaling decisions should be localizable.

Maintenance: The most expensive of all life-cycle concerns. The cost of understanding code, finding the right place to make a change, and ensuring the change doesn't break anything else dominates long-lived systems. Architecture that makes each concern local minimizes maintenance cost.

The Architect's Mindsetโ€‹

A software architect is not primarily a decision-maker. They are primarily a decision-deferrer โ€” someone who structures the system so that the most expensive and irreversible decisions can be postponed until maximum information is available.

This is the opposite of the "architect in the ivory tower" who prescribes every technology choice upfront. The effective architect:

  1. Identifies the core business rules that will never change
  2. Identifies the details that are likely to change (databases, frameworks, UIs)
  3. Draws boundaries between them
  4. Ensures the core doesn't depend on the details

In Practice: Spring Boot Architecture Decisions to Deferโ€‹

Decisions to make NOW (high-level policy):
- What are the use cases?
- What are the domain entities?
- What are the business invariants?

Decisions to DEFER (details):
- Which database? (use in-memory H2 initially)
- Which message broker? (use synchronous calls initially)
- Monolith or microservices? (start monolith)
- REST or GraphQL? (doesn't matter yet; hide behind use case interface)
- Spring MVC or reactive? (encapsulate behind controller abstraction)

Summaryโ€‹

ConceptKey Point
Architecture is shapeHow a system is divided into components and how they communicate
Primary goalSupport the system's life cycle: develop, deploy, maintain, operate
Preserve optionsGood architecture maximizes decisions NOT yet made
Not about toolsArchitecture โ‰  choosing frameworks; it's about boundaries and dependencies
Four concernsDevelopment, deployment, maintenance, operation โ€” all must be served