Let's Talk About How to Cultivate Architectural Thinking. Have You Learned It?

When it comes to architecture, many programmers may immediately feel in awe, thinking that it is a very high-end, difficult and challenging thing. However, compared with programming, architecture focuses more on the macro level. Although architecture does have some challenges, at some point, the "world" of architecture may not be as complex as the details in coding. All programmers should cultivate their architectural thinking as early as possible. Even if you don't work in architecture-related jobs in the future, having architectural thinking can greatly broaden your horizons and help you go further on the road of technology.

Before understanding the specific methods of cultivating architectural thinking, we need to first clarify what the meaning of architecture is. Simply put, architecture expresses a relationship, that is, the relationship between multiple real elements. There are two key words here: relationship and reality. Among them, "relationship" is easy to understand, referring to the form in which different things coexist. "Reality" is often easily overlooked because it seems very ordinary. However, when doing architecture, if the definition of certain realities is not accurate, then the subsequent work is likely to be wrong. Therefore, to do a good job of architecture, the first step is to first clarify the current problem to be solved or the goal to be achieved, and figure out the business meaning expressed by the relevant concepts involved. You can draw the relevant concepts obtained in this step with tools or paper and pen, and spread them out.

After this step, the next step is the traditional process of architecture. This process can be summarized in one sentence: the architecture process is actually the modeling process. The so-called modeling is to further refine the current things, and make relevant extensions and plans based on the information obtained, step by step, to obtain a complete and executable solution.

It is easier said than done. In the process of architecture, decomposition, integration, reuse, layering, abstraction, structuring and iteration are involved. How to do it specifically? You can refer to the following 5 steps.

Step one: figure out the real problem to be solved.

When you get a function of a certain scale, you need to first figure out what problem this function is going to solve, and don’t just write code or look for ready-made solutions. If you always copy others, it will be difficult to develop your own architectural thinking.

Step 2: Determine the boundaries.

It is necessary to consider what input data there is in the scenario where the problem occurs and what the final output is, so as to determine the boundaries of the problem.

Step 3: Use decomposition, abstraction, and structured thinking to break down the problem and sort out each process.

Break down the problem and see which small problems can be solved before the big problem can be solved. Then, think about whether there is a solution to each small problem. If there is, you can draw the logic in the middle with a flowchart. If the logic is too complicated, it means that the granularity of the problem is still too large, so continue to break it down. If there is no solution to a small problem, continue to break it down until a solution is found.

Step 4: Use integration, reuse, and layered thinking to provide the most reasonable technical implementation plan and form a complete architecture.

Based on your own technical reserves, give specific technical implementation solutions for each problem and choose the simplest and most efficient one. Then put all the solutions to the problems together, extract the reusable parts, and consider what form to encapsulate them in. It can be a simple library, a complete framework, or an API, etc.

Step 5: Make partial revisions to the architecture plan based on predictions about the future until it is reasonable.

Based on your understanding of the business and communication with product managers and business parties, predict possible subsequent expansion points to see if the current design can meet them. If not, work backwards from the parent problem level by level until you find the root problem related to the new expansion point, then stop and redesign all the sub-problems under this root problem. Then repeat step 4 until you get a solution that seems to fully meet your expectations.

After the whole process, you have completed an architectural design work, which can help you develop your own architectural thinking. After you become proficient, you can also delete some steps according to the actual situation.