Rethinking Outputs of Software Architecture

Increasing popularity of Agile Software Development has made architecture and upfront design much less relevant, in some systems even nonexistent. However, the developers still complain about the architecture when things get tough and there’s lot of rework ahead. We expect the architecture to be a solid foundation for future development, not an art of creating confusing diagrams and forcing conventions on developers. I’m on the finish line of reading Lean Architecture for Agile Software Development and it provides some really interesting insights into the topic.

Putting the Focus on Domain Objects

There’s a lot of intersting concepts in the book (it will surely be one of my favorites next to DDD and Clean Code), but one of them is especially appealing to me. It’s the idea of interfaces (or abstract base classes) of domain objects being an output of early architecture work. Why those?

We know from Domain-Driven Design that putting the domain at the heart of software gives foundation to better solutions, because business people and their needs are highly connected to the underlying domain. If we manage to express the domain in the software, then the new requirements will fit the existing model and extending the software should be relatively easy. Much of the work in DDD is connected to discussing with the domain experts and picking the right aggregates and entities that together can work to satisfy business needs. In the Lean approach, we want to do something similar, but not quite the same.

In DDD, there’s a whole section of refactoring towards deeper understanding of the domain. There’s even a story when a team reaches a breakthrough and they have to choose: reworking a huge part of the software to make it better aligned with the domain or continue using the old model that doesn’t fit the new requirements well. This is the kind of problem that Lean tries to prevent. We want to eliminate rework late in the project by gathering as much information as possible in the early stage.

Everybody, All Together, From Early On

The secret of the Lean approach is to gather all interested parties from the very beginning and allow them to provide inputs to the architecture. We want to understand the needs of every stakeholder: end users, bussiness people, domain expers, managers and even developers. At this point, we leave the nerdy stuff away and we hold on with coding for a while. We try to understand the requirements, the underlying domain and capture a model that will hopefully fit everyone’s needs. Of course, this might not be possible and some trade-offs will have to be made. But we want to know about them and agree on them as early as possible to avoid surprises.

The understanding (model) that we get has to take form of some artifact that will later help the development team. That will guide them through the development process and prevent re-inventing the wheel. It could be a bunch of diagrams, but these have no impact on the codebase unless the developer actually translates them to code. We also don’t want to code the whole domain stuff at the very beginning, that would not be very agile, would it? The solution proposed by James Coplien is the use of interfaces or abstract base classes. They impact the code directly and yet they allow you to implement the functionalities one by one.

Testing the Architecture

It would not be very Lean, in the sense of eliminating rework, if we produced a bunch of interfaces that would not actually work in practice. For this reason, we want to test the produced architecture. The process can be as simple as running a design session with developers trying to “simulate” implementing the known use cases using objects that match the proposed interfaces. You should be able to see if all the objects and methods are used, if there is something missing etc.

It’s Not (Good) Enough

This text is just a rough overview of the idea, not a comprehensive description. I have approached writing this article 3 times already and I just can’t find the right words to describe it without rewriting a chapter of the book. I hope that it gave you at least some understanding and inspire you to rethink your approach to architecture, if you’re still seeing it as ivory towers and diagrams. For a good enough description, read the book – totally worth it!

About the Author Grzegorz Ziemoński

King of Tidy Java, nerd that thinks about producing perfect software all the time and proud owner of 2 cats.

follow me on:
  • Tim

    Isn’t using interfaces for modeling a limitation placed upon us by java?
    By reading more about FP I believe Type aliases would fit better than interfaces for modeling.