logo
Published on

Building Software Like Building a House: My Thoughts on Architecture

4 min read

Authors
  • avatar
    Name
    Shuwen
    Twitter

Building Software Like Building a House: My Thoughts on Architecture

Recently, I've been refactoring a project and slowly shifting toward Clean Architecture and Hexagonal Architecture. At first it felt like just another engineering best practice, but the more I worked through it, the more a simple metaphor came to mind:

All these architecture patterns, Clean, Hexagonal, Onion, are different names for the same underlying idea. And that idea feels a lot like building a house.

This was not something I got from a book. It came from refactoring real code, running into limitations, and realizing why some designs feel stable and others feel fragile. So this post is simply my personal story and understanding of software architecture.

The Blueprint Moment

At one point, I stopped thinking about classes and started thinking about the user. What does the user do? What actions matter? What outcomes do they expect?

This changed everything for me. When I focused on behavior, the domain started forming naturally. The domain felt like rooms on a blueprint, each space created for a specific purpose.

A blueprint never describes how the construction will be done. It only describes what must exist. The same applies in software architecture.

Interfaces: Naming the Rooms

Once I understood the behavior, I expressed it in interfaces. They felt like labels on a floor plan.

This room is a Product Finder. This room is a Mission Loader. This room is a Salary Calculator.

These interfaces are the labels. They describe what the room is supposed to do, not how I am going to build it. That separation became the foundation of my architecture thinking.

The Construction Phase: Implementations

After defining the behaviors and interfaces, I moved into the implementation layer, the actual construction work. This is where all the complexity and noise lives:

  • External API calls
  • Parsing JSON, XML, Parquet
  • Database queries
  • Error handling
  • Library-specific logic
  • AWS S3, Puppeteer, and more

Just like a real house, you can replace pipes, tiles, or wiring without changing the blueprint. In code, that means:

  • Swap a library without touching the domain
  • Rewrite the persistence layer without breaking business logic
  • Add a new implementation for an existing behavior
  • Change infrastructure with minimal risk

Once I embraced this model, adding new features felt much less dangerous.

Adding New Features Without Breaking the Foundation

One of the biggest wins came when I added a completely new behavior. All I needed to do was:

  • Add a new interface describing the new behavior
  • Implement the behavior in the infrastructure layer

And that was it. The domain stayed untouched. Nothing old broke. The architecture supported new growth exactly like a well-designed building supports a new room addition.

This separation made debugging easier, testing cleaner, and the entire codebase easier to read.

Clean Architecture, Hexagonal Architecture, Same Philosophy

Before this project, these architectural terms felt abstract. But after using them in practice, I realized they are all teaching the same core idea:

Describe what the system should do, then separate that from how the system does it.

Architecture is not about diagrams, circles, ports, or adapters. It is about clarity. It is about defining the user behaviors as the blueprint, the foundation that should remain stable as everything else evolves.

What I Learned

Here is what changed for me after applying this approach:

  • Adding new features became predictable
  • Testing the domain became simple and enjoyable
  • Debugging had clearer boundaries
  • Reading the code felt like reading a narrative of user behaviors
  • The system felt ready to grow without collapsing under complexity

I used to think architecture was about strict rules or enforcing structure. Now I see it as a natural evolution that happens when you get tired of fixing tangled code.

Final Thoughts

Seeing software architecture as building a house helped me rethink how I approach code.

Start with the blueprint, user behavior. Define the rooms, the domain. Label them clearly, interfaces. Build them with replaceable materials, implementations. Let the house grow one room at a time.

Clean Architecture, Hexagonal Architecture, or Onion Architecture are not trends. They are ways to build software that respects the user, respects the system's future, and respects the engineers who will maintain it.

This is the philosophy I plan to carry into every system I design going forward.

© 2025 Shuwen