Have you reached these four levels of coding?

Have you reached these four levels of coding?

[[234603]]

As a software development engineer, coding is definitely the first skill. Coding should not just be a job, but a way to create a work of art that will last forever. Artistic creation must have a certain realm, so here is a simple gradient from low to high for a person's coding realm.

“My code is done”

When I received the task, I started writing line by line like a worker on a production line, without any plan. I wrote whatever came to my mind, regardless of the coding style, whether the algorithm was optimal, or whether others could understand it. After I finished writing, it compiled and ran, I told my boss, "My code is done," and handed it in hastily. The quality is a matter for testing. At most, if there are bugs, I will fix them later. It looks fast, but it is actually slow over and over again. This is the lowest level.

“My code is done.”

When I receive a task, I first plan how many modules and functions there are, and then complete each module one by one according to the prescribed code style. I will also try to choose a good optimization algorithm and add comments so that I and others can understand and maintain it. After writing, I will read it several times to see if there are any problems. After all, it is difficult for people to get everything right at once, and checking is an indispensable part. When compiling, I will pay attention to every warning and fix them. I will also think of a few test cases and run them. If I feel there is no problem, I will submit and tell my boss, "My code is written." This is a much higher level.

“My code works”

When receiving a task, in addition to writing code in the above way, various white box tests will be added in the process of writing code. That is to say, after writing each function, a unit test will be written to verify that the code can run correctly in various normal and edge cases. At the same time, attention will be paid to the code coverage of the test, that is, every line of code will have a test scenario run through. If other services are used, other services will be mocked up so that your system can run correctly. For the above modules and systems, there are integration tests and regression tests. Although the workload is increased in the process of writing code, the probability of error in such code is significantly reduced, and the number of back and forth repairs required in the middle is significantly reduced, which actually reduces the total workload and saves project time. This is a responsible attitude and a basic quality that an engineer should have. This realm is very advanced.

“My code is still working”

Code is like a work of art. Good works of art are immortal, and so should good code. So engineers should treat code like creating a work of art, thinking carefully and carving it meticulously, hoping that it can live forever in the product. When you are old, you can still proudly tell people, "My code is still in use." This requires that the code is well written, of high quality, comprehensive, efficient, almost bug-free, easy to understand, maintain, and use, and it has been refined. For example, if there are different algorithms to implement a function, you will write code to experiment with the performance of different algorithms in this scenario, compare the advantages and disadvantages, and choose a reasonable and efficient algorithm to use. Such work is not easy to be replaced unless future generations invent better algorithms. Writing code is an art, and the code written is a work of art. This state is the highest goal that every programmer should pursue.

Only when you have the thought of "being responsible for your own code" in your heart can you reach the highest state of "my code is still in use". And "being responsible for your own code" should be the basic quality of every engineer. In this way, the code you write can become a work of art and be passed down through the ages.

"What is your legacy?" Code may be an asset that programmers leave to society.

<<:  How to use multiple windows on Android? An Android multi-window tool with a size of only 1M

>>:  iOS 12 foreshadows five future trends for iPhone and iPad worth paying attention to

Recommend

New discovery! The origin story of angiosperms hidden in "stones"

Produced by: Science Popularization China Author:...

Why Mars is the first choice for deep space exploration

Human exploration of Mars began in the 1960s. The...

Five software development trends for 2020

Over the past few years, a lot of software develo...

Community, e-commerce, tools, which one is the future of the women's market?

Since the rise of the mobile era, consumer habits...

8 common ways to leverage hot events for marketing

In an era where marketing is rampant, whoever cap...

Introduction to Android hardware acceleration principle and implementation

In the process of developing mobile client, espec...

Why is Bluetooth called "Blue"? Can't it be called "White"?

As a fashionable and technological youth, there a...

Facing fatal temptation, how to become a "mushroom hero"?

Wild mushrooms are delicious, but some people mis...