Why Invest in Clean Architecture

Over the years I have been in various discussions regarding clean architecture and I think on some degree most of us are aligned on the reasons behind it. However, having a clean architecture or code-base not only makes your development team happier, but it has far reaching impact on business itself. In this blog post I will share some of these points and try to describe its benefits in context of business world. Please note, these principals and points are not only to software architecture but could be applied to any domain in a generic manner.

So, why should we invest in clean architecture?

The primary justification for investing in clean architecture is mainly a cost/benefit argument. Our goal, as software architect is to minimize the cost of creating and maintaining software, while we maximize the benefits; that’s the business value that software provides. Our overall goal, thus, is maximize the Return on Investment (ROI). Clean Architecture help us to do that in several ways.

How does clean architecture help us?

Focus on essentials

First, clean architecture focuses on the essential needs of the primary inhabitant of the system i.e. the users. We attempt to build a system that mirrors the use-cases and mental models of the users by embedding these use-cases and mental models in both our architecture and code.

Build only what is necessary

Second, clean architecture builds only what is necessary, when it is necessary. We attempt to create only the features and corresponding architecture that is necessary to solve the immediate needs of the users in order of each feature perceived business value. We attempt to do this without creating any accidental complexity, unnecessary features, premature performance optimization or architectural embellishments. This helps to reduce the cost of creating the system.

Optimize for Maintainability

Third, clean architecture optimizes for maintainability. For an average enterprise application with a significant long life cycle, say 15 years or so, we spend more time and money maintaining the system than we do creating it. So, if we optimize for maintainability, which clean architecture does, we in theory reduce the cost of maintaining the software.

This focus on value adding cost reducing activities attempts to maximize the ROI of the software a whole.

Context is the King

Do you notice, if you ask an architect that how much it will cost for software, he will most probably say; “it depends“. How much time? “it depends“. There is a good reason for this, and its because context is the king in land of architecture.

Every answer really depends on several often conflicting constraints and optimization goals that architecture’s subject to, many of which are outside of the control of the architect. Every time, we make an architectural decision, we are trading one thing for something else. Often times, we are trading one kind of complexity that we don’t want for another kind of complexity we also dont want either, but we would prefer to have over the first kind of complexity.

As, mentioned earlier, the ultimate goal of an architect is to make decisions that trade-off things like complexity, in such a way that minimize the cost and maximize the business value.

That is why it is important to learn the various patterns, practices and principles, understand the pros and cons of each and understand within which context they are effective or not.

Ultimately, we need to make our best judgement, make smaller mistakes and use feedback from these small mistakes to improve over time.

I will also recommend reading the book by Robert C. Martin (Uncle Bob) and his blog posts on the same subject. You can find more info about in the reference section below.

If you have some comments, personal experience or thoughts on this subject, feel free to share it with me and others. Till next time, Happy Coding.

References