Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write code Review

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to write code Review". In daily operation, I believe many people have doubts about how to write code Review. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to write code Review". Next, please follow the editor to study!

So how to make a code Review? To make a qualified code Review, we first need to know what roles there are in the process of code Review and what kind of process is needed.

Role

Author, author of the code

Reviewer, a colleague who reads the code

Host Host

Recorder, the recorder.

Process flow

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Send Review code email to relevant personnel one day in advance to confirm Host and Recorder

Host chairs the Review meeting

Code walkthrough by Reviewer and Author

The improvement record is carried out by Recorder.

Before doing the code Review, Author needs to send a formal email to the relevant personnel one day in advance, and send the code that needs to be Review to the relevant Reviewer by way of email attachment for them to read in advance, so that Review can be carried out more efficiently. And communicate the code Review meeting Host and Recorder in advance. Host is responsible for organizing everyone to speak and maintain order during the meeting to make the code Review more efficient; Recorder is responsible for recording the points mentioned in the whole Review process that need to be optimized and improved in the form of documents, the recorded information needs to be concise, which file and which line of code, the problem is what, and suggestions for optimization need to be written down, and after the meeting is over, it is sent to Author and CC in the form of email.

Review

When carrying out code Review, Author needs to read the code line by line from the first line of the file, and describe each line of code. What should be noted here is that do not think that a function is very simple, and you can pass it through in one sentence. Often, many online Bug are caused by this neglect. When walking through the code, Author needs to explain the meaning of each line of code, explain what this line of code is for and why it is written this way. On the other hand, Reviewer needs to ask questions or improve the plan according to the description of Author and his previous understanding of the code.

While the code reading process continues, Recorder needs to record what needs to be improved in time, and record the proposed optimization plan. The process of code reading is the core of the whole Review, and we need to pay attention to a lot of things in this process. Zhihu has a question about how does the Code Review of your company do? What questions have you encountered? there are some good points raised in the above answer. I think it is necessary to share them with you, which will be very helpful to our entire Review, especially when we are Reviewer.

It's not about people. To remember that we are all colleagues, today we are Reviewer to Review other people's code, which day others will Review their own code, so in the whole code Review link, we can put forward our own suggestions, but we need to pay attention to our own words and tone, although programmers have a chain of disdain, and all think that other people's code is garbage, but this time can not talk nonsense, easy to fight, or to be modest.

Evaluate with positive words. As mentioned above, we need to evaluate the code in positive terms and consider the mood of Author, even if the code is not well written. This is easy to understand, after all, the code Review is in front of a lot of people, for Author, let others see their own code is like running naked in front of others, so we should not only put forward suggestions in good places, we should also give positive praise.

If there is a better plan, it must be put forward. The purpose of code Review is to optimize the code and find out the hidden BUG and logic problems in the code. So if you find any inelegance or problems in the code, you must bring it up in time, don't worry about what you said is wrong, or consider the face of Author, don't point it out, provide a better solution, and let us make progress together.

Review meetings are about Review code, not discussing requirements. This is also a point that is easy to be biased. Often we will find that in the process of Review, it gradually becomes a discussion of requirements, which must be avoided, otherwise the whole code Review will fail and cannot go on. So when initiating code Review invitations, Author must make sure that the requirements they understand are correct and avoid wasting everyone's time.

Efficiently. When carrying out code Review, we need to pay attention to be efficient, how to achieve high efficiency requires everyone to be prepared accordingly, Author needs to skillfully explain their own code, Reviewer needs to take a look at the code of Review before attending the meeting, find the Bug that may be hidden in advance, and make notes for places that you do not understand, so that it can be pointed out in time when meeting.

Avoid formalism. This point is also ignored by many partners, with the code Review more and more times, many partners may regard this as a task, slowly become formalism, rather than pay attention to reality, every time the code Review is very casual, long-term go on like this is not good for the company, the team and themselves, but also a waste of time.

At this point, the study on "how to write code Review" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report