10 programming tips for programmers to write high-quality code

1 Reconstruct the thinking model

Don’t start writing code as soon as you come up. Master as many refactoring methods as possible, refactoring the way of thinking, mastering refactoring does not necessarily mean refactoring the original code, but allowing yourself to figure out what to do before operation get on.

2Find out the needs before doing it

After seeing the requirements, there must be more or less problems, or errors in understanding, or problems in function implementation. At this time, you must communicate clearly, otherwise, there will be more problems in the follow-up.

3 Documents should also be written

Many people may think that no one reads the document, and it doesn't matter whether it is written or not. However, no one reads the document, so I still have to write it. Most of the time, the role of the document is not for communication, but for recording. Most of the needs are communicated verbally, but if you don't write a document for record, it will be easy to follow up.

4 must write code comments

You must write a comment. If you don’t write a comment, it will take a long time and you won’t even be able to read it later. Moreover, you cannot be responsible for a project alone, and comments can make other colleagues understand your code.

5Communicate requirements and change

Don't expect that the demand will remain stable. Product demand is constantly adjusted and optimized according to business needs. It is normal to change demand. Don't always complain. The best way to adjust your mentality is the last word.

6 handle the relationship with the business

Regardless of whether it is technology or business, don't think about being superior to each other, it should be a complementary relationship. Technology that does not serve the company's business is worthless, and the company makes money is the last word. Don't be entangled in the company's changing needs and business.

7 Don't be lucky

If you feel a bug somewhere, then it must be a bug. Don't take a fluke. You must optimize the areas where you feel bugs will occur, so as to avoid future problems.

8 Test yourself a few times

Don't throw it to the tester after you finish writing it. Be sure to test it a few times by yourself. You will be more familiar with what you write and find problems easier. We must ensure the quality of things we handle.

9 Try to solve the problem yourself

When you encounter a problem, try your best to solve it yourself. If you can't solve it, then ask for help. In the workplace, no one is obliged to wipe your butt, and bosses and colleagues have their own problems to solve.

However, if the problem is urgent or serious, you must ask for help as soon as possible. Don't be afraid of being scolded. When a problem occurs, the consequences may be more serious.

10 Use new technologies with caution

I don't deny that new technologies are good things, but when they use them, they don't have 100% confidence in their own opinions. If there is a problem and cannot be solved by yourself, there will be irreparable losses.

Therefore, after receiving the project, don’t rush to start writing code, but think first. When the needs are clear and you have a good idea of ​​the work of each section, you can start writing. It is more efficient and has a chance of error. Also lower.

Guess you like

Origin blog.csdn.net/qf2019/article/details/106325883