Many students who have never actually worked may think that the only job of programmers is to write code + "pull" with product managers, and they will habitually use the amount of code to evaluate a programmer's work intensity and level, thinking that the code words are flying. , A programmer who can write tens of thousands of lines of code every month is a big guy.
I used to think so too, but it wasn't until I officially started working in the company that I found out that it really wasn't the case! High-end students always use the shortest and most subtle code to solve problems. Including many high-level bigwigs I know (called "architects" by the outside world), their average code volume is very small, and some even don't write code at all.
So what are their jobs?
The most common work is design . The design here does not refer to drawing a picture design draft, but to design the overall architecture of the system, or the solution to design requirements, the division of the entire system, and the allocation of resources according to real business needs. Coordinate scheduling, etc.
Through this, it also reflects the importance of design. Code is just a medium (or a tool) to express our thoughts and our designs.
Maybe our work has not reached the level of architects, but when we make the process of requirements, we must design: first clarify the business logic, think about how to write the code, and then write the code according to the design to implement (similar to the translation process) .
When I first interned at Tencent, my mentor arranged a big job for me - refactoring the old system into a new framework. I thought it was very simple at the time, isn't it just to replace frame A with frame B? The business logic basically does not need to be moved, and it can be done in minutes! So when I was scheduling, I swore to tell my instructor: 3 days to complete.
My mentor just smiled: young people, don't be too confident! take it easy.
And guess what? I did that requirement for over a month. . . It is because there is no design how to do it, and there is no research on the differences between framework A and framework B, so you can directly change the framework and write code, resulting in errors everywhere, and even affecting the business logic.
A few times, I thought the requirement was simple, and I wrote code without even thinking about it. As a result, I found a big problem in the process of writing code, like walking through a maze and reaching a dead end. If the design is done first, with a clear route and plan, and then the code is written, the probability of delays and rework will be greatly reduced.
So it is self-evident how important design is.
So how should it be designed? Design is divided into many types, such as system design, architecture design, detailed design and so on. Each expansion can be tens of thousands of words, and here I will pick out the detailed design and talk about it.
The so-called detailed design, as the name suggests, is a very detailed design.
For example, what is the specific business process and what steps are there? How to implement an algorithm specifically?
Just last week , I took everyone to do a project in the live broadcast of the planet. The demand is to develop a background for the user registration function. Let me take the detailed design of this registration function as an example, as shown in the figure:
Looking at it from top to bottom, you will find that a small registration function has so many places to consider and various verifications. If you don’t design and write the code directly, will you miss some verifications, make mistakes in key steps, and cause problems with the entire system? If you find a problem and then change the code later, it will be more troublesome (you have to go online repeatedly).
So when developing requirements, especially those that contain complex business logic, don't take it for granted and write code directly. Instead, like the example I gave above, you can design it first, figure out how to write the code, and then write the code according to the design. It is very simple~
Students often ask me how to improve business thinking and why I can quickly think of implementation plans when I see many systems. In fact, it is because I usually think and design in my heart when I do any requirement. I also strongly recommend that you do this, the more you use your brain, the better it will be.