This article was first published on my website lingenliu.cc

Why clean architecture

This is The first article in a series on The Clean Architecture proposed by Robert C. Martin, explaining why we need such a Clean Architecture

Software is complex in nature

Because software is inherently complex

All programmers will agree that software is too complex. But contrary to what most programmers might understand, software complexity is not due to technical reasons such as too many coding languages or frameworks, or rapid updates.

In the book Object-oriented Analysis and Design, the first chapter is very clear about why software is inherently complex

  1. Complexity of the problem domain
  2. The difficulty of managing the development process
  3. Flexibility is possible everywhere in software
  4. Difficulties in describing the behavior of discrete systems

As a result, decades of updated coding concepts are also responsible for constantly dealing with software complexity.

The emergence of various software theories and methodologies, such as agile software development, DDD driven methodologies, as well as a variety of new technical framework languages, such as Kotlin,React,TypeScript, etc., are designed to deal with and solve this problem.

Programmers are more specific

From the author’s years of work experience and get along with a variety of technical personnel, the author can come to a theory, or can say at least in the domestic programming community this is a relatively obvious phenomenon

That is:

Our programmers are more focused on concrete, that is, specific language and technical frameworks, rather than abstraction and methodology.

That is, in the tao and art of programming, the focus is on the art rather than the tao

A very common manifestation of this is that programmers tend to prioritize the following points when designing an architecture:

  • What language to choose, such as Java,Kotlin, Or Scala
  • Whether to choose the Spring framework
  • JPA or Mybatis framework
  • What is the best framework for a microservice discovery center
  • React or Vue

And so on

Of course, I’m not saying there’s a problem with these considerations, but it’s clear that there’s a tendency for us to focus more on specifics. On the other hand, instead of focusing on and trying to solve the complexity of software, we focus more on the details, resulting in software getting more and more complex over time.

An important overlooked feature of architecture: maintainability

When we are in the design or evaluation of an architecture, takes a lot of points, such as performance, scalability, stability and maintainability, etc., in these elements, often performance and scalability, cluster, cache some characteristics such as more valued and considerations, and tend to be quite a lot of programmers, including some good programmers ignore is an important feature of maintainability

Maintainability should be the most important feature in the evaluation and consideration of software quality. Because software is always maintained and updated, you design and implement software architectures that not only meet the needs of the present, but also ensure their sustainable iteration and maintenance, and meet the needs of the future

One reality is that programmers are more likely to work on new projects and less likely to work on old, existing ones. This is because it is well known that existing or existing software is often more difficult to develop, not least because it is less maintainable

Solve and improve these problems with a clean architecture

From the author’s analysis above, it is clear that clean architecture is for

  • Make it easier for software to cope with complexity
  • More concerned with abstraction and methodology than concrete language technical framework
  • It is easier to ensure the maintainability of software

If we want to be a really good programmer, we need to focus on good methodologies as well as new technologies.