Introduction

In the book “Fundamentals of Software Architecture”, the authors define software architecture like so:

« The software architecture of a system consists of an architecture style as the starting point, combined with the architecture characteristics it must support, the logical components to implement its behavior, and finally the architecture decisions justifying it all »

Four dimensions that architects must think about when conceiving the system. In our journey to explore what an architect must do and think, we’ll start by talking about Architecture vs Design. When is a decision a design decision? When does it become an architectural decision?

What’s the difference?

Imagine that you have an outdoor space that you want to transform into a garden. Your dream garden.

How many trees does it have? Does it have a barbecue set in concrete? Is it surrounded by hedges? Do you want to create a pond?

These decisions define the structure of your garden, that would be its architecture.

Now, let’s get more detailed. Do you want to plant flowers? Which type? Are they red? Blue? What color should the barbecue be?

These are more about the design of your garden.

Why is the pond architecture and the flower color design? Because removing a pond means digging up the garden, while changing flowers takes an afternoon.

The criteria

But how do you know for sure which is which? Well, like most things in software, it depends. Software architecture is all about context. Each context might make you choose different answers to a problem, and yet, each answer may be right.

There are three questions to ask ourselves:

  • Is it more strategic or more tactical? What’s the scope?
  • How much effort does it take to implement or change? Meaning, not only doing the change, but what if I need to rollback the entire decision ?
  • How significant are the trade-offs? What are the compromises?

Asking yourself each of these questions will give you a pretty solid idea of which side of the spectrum your decision is.

Strategic vs tactical

How can we know if a decision is more of a strategic one or a tactical one?

Well, the book provides us with a few subjective questions. Things like:

  • how much thought and planning is involved in the decision?
  • how many people involved in the decision?
  • is it a long-term strategic decision or a short-term tactical one?

Let’s take examples.

We have a module billing. A component that displays information wants to use the Observer pattern to refresh itself.

Architecture or design?

In this case, everything stays in the same module. It shouldn’t affect a lot of people on the team so its scope is small. Design.

But what about: billing wants to react to the changes on the module users. Module maintained by another team and more modules plan on doing the same thing. Well now, that decision creates a contract between modules, and we have to coordinate with another team. Architecture

It’s all about context. Both cases feel very similar, a module wants to use the observer pattern. But in the end, the decisions are completely different, yet both rankings are correct. It’s not the technique or the person that determines the ranking, it’s the impact of the decision.

Cost of Change

This one is pretty straightforward. How much time do I need to implement that change? What does it cost to do it? And also, NOT do it? Does it become more and more costly as time goes by?

For example, a developer chooses to store an amount field in float in the database. What seems like a simple type decision is actually on the architecture spectrum. If my whole application handles those amounts, everything is impacted. Plus, this decision is written in the database model so the cost becomes higher as time goes by, because every transaction persisted is more data we’ll eventually have to migrate. And what if we decide to rollback that decision in 2 years? That is costly. All of this makes it fall on the architecture side of decisions.

Trade-offs

In software, we compromise. We have constraints to work with. Sometimes we have to adjust to the reality. If a developer tells you that their solution is the perfect solution and it has no trade-offs, well it’s because they haven’t identified them and that’s a problem.

As the first law of software architecture says in the book:

Everything in software architecture is a trade-off.

You ALWAYS sacrifice something when you take an architectural decision. The difficult and crucial part is to know what you sacrifice.

For example, a developer proposes to you that the whole logic behind calculating the budgets should be written in stored procedure in PostgreSQL. That’s a BIG decision. But what are the trade-offs of such a decision? What do you gain? What do you sacrifice?

Gains

  • Performance: Can reduce network round trips by processing data directly in the database.
  • Security: Least privilege, application only accesses the procedure, not the tables.
  • Reusable: the same procedure can be used by different applications

Sacrifices

  • Scalability: all the work is now done on the database, harder to scale out.
  • Portability: What if we move from PostgreSQL to mySQL? Does it work? How much time and effort will we need to achieve that migration?
  • Coupling: All applications depend on the same procedure.
  • Testability: Every test will require a running database.

Note that coupling and reusability talk about the same thing, but from a different perspective.

So, knowing all this, you can make a decision. It could be interesting if you have several applications that share the database. But it could be risky if you ever need to scale out. The context of your system (software, but also the politics inside your organisation) will help you make the proper decision.

Conclusion

In this article, we began thinking like an architect. Out of the four different dimensions, we focused on the architecture decisions by trying to understand the impact of every decision we could make and how everything depends on the context you are dealing with.

Do you have example of decisions that seemed like a design decision but ended up falling on the architectural side of decisions? Why?

Have fun <3