The company code is so bad that I don’t need anything I learned!

When I first entered the industry, I would complain when I saw something uncomfortable :

Why does this project still use such old technology?

This code is terrible!

Why did you not write unit tests?

......

Of course, some ideas for improvement followed :

Change to a new framework!

Refactor this module!

Fill up the unit tests!

Just rewrite it!

......

In fact, I am definitely not the first person to have these ideas. People who have such ideas have existed years ago. These ideas of mine have probably been put forward and thought by many people.

But why do these problems still exist?

Because it is difficult to do it, I thought about it, but couldn't do it.

There is a very incisive sentence in the TV series "Soldier Assault" that I like very much. At that time, Xu Sanduo was transferred back to the headquarters of the 702 regiment from the 5th squadron of the grassland. He saw a model of a chariot in the regiment commander's office and liked it very much.

Seeing this situation, the head of the group came with a sentence of chicken soup in a strong Wuhan dialect: want and get, there are two words in the middle, that is to do.

Xu Sanduo should have listened to it, and then he really "made it". When he entered Old A, he took the tank model away.

Back to our programming field, how can we "make it" for these difficult problems?

How can you find a way to promote your own ideas and implement them successfully?

01

A classic case

In 1990, Jerry Stening was ordered to go to Vietnam, he wanted to improve the local children's malnutrition within 6 months.

Research reports at that time generally believed that the causes of malnutrition were poor sanitation, poverty, drinking water problems and lack of nutrients. These are correct nonsense, the key is how to change it?

Jerry visited the villages to investigate the conditions in various regions and measure the growth of various children. He finally found that the children of a group of families, although poor at home, are healthier than ordinary children.

The reason lies in the method of feeding the child: eat less and more meals, let the child eat some shrimps and crabs, and add sweet potato leaves to the rice. This is exactly what Jerry needs to improve the health of children without increasing costs.

After finding a role model, Jerry found the villagers and told everyone: As long as you wash your hands before meals, eat less and more meals, and add shrimps, crabs and wild vegetables as a supplement, your children can grow up healthy. This simple method was quickly accepted by the locals.

Six months after Jerry arrived in Vietnam, 65% of local children's nutritional problems have been improved and continue to be maintained.

As can be seen from Jerry’s case, to accomplish one thing, at least:

1. A thrilling prospect

2. A successful example

3. And practical methods.

02

Back to programming

Let's take a case in the field of programming: how to promote the establishment of a set of automated tests in your own department?

Needless to say, the wonderful prospect of automated testing: it can weave a big net for the entire project. If new code breaks existing functions, it will be "captured" immediately, and programmers will feel very safe to modify the code in the future.

Next, find a successful case, so that everyone can see the power of example.

Unfortunately, your department is still poor in this regard. You need to take the lead and come out:

1. Which parts need to be automated testing?

The main push is unit testing or functional testing?

Where is the high return on unit testing investment? Which areas are best covered with functional tests?

2. What kind of tools are needed?

Is there a suitable one on the market? Do I need to develop it myself?

3. What are the obstacles to automated testing on the current system?

Do I need to refactor the code to write unit tests? How to do mock when encountering components that are difficult to test?

......

As the first person to eat crabs, it was very hard to solve these problems.

On the way to hard work, it is better to have like-minded partners. Some enlightened managers will also set up an interest group. You can study together and see if you have such good luck.

After you have the example results, you have to show and persuade. You have to show how you did automated testing, what obstacles you encountered, and what remarkable results you have achieved. For example, if you catch errors through automated testing, you can modify the code more confidently. The coverage rate has increased by xxx, and the refactored code is easier to read and maintain, etc.

Use examples, diagrams, and numbers to illustrate. It’s easier to move people. It’s better to give a step, evaluation method, and best practice that can be implemented, so that others don’t have to think much and just follow along.

Unlike Jerry's situation in Vietnam, it is more difficult to change something in the field of programming and will encounter more resistance. For example, some people will say: too busy, working overtime every day, and no time.

So if you want to implement it successfully, you have to do both:

1. Be consistent with the KPI of the department/manager

The department also has KPIs for optimizing processes and improving code quality. It is the easiest to succeed if it is consistent with the goal of the department/as an aid.

2. Profit-driven

People are self-interested, and nothing is more important than self-improvement! Learning UT, refactoring, mocking, and doing automated testing. For junior programmers, writing in the resume is also a bright spot, so the motivation will not come!

03

to sum up

It is not easy to push to accomplish something, especially when you are not a leader or authority. You have to do everything possible to establish a vision, set an example, and find a way to promote it.

However, the difficulty will be distinguished, and what can be done is not an ordinary person, and it will definitely stand out.

I suggest you find a field that you are good at, try it, the gain is huge.

 

Guess you like

Origin blog.csdn.net/coderising/article/details/110152505