How to decide which parts of the code you want to view?

Esp. if there is a very large code base, and if the team also performs a certain level of test development, it is impractical and it also makes no sense to review the entire code base. In this case, how do we decide which parts of the code should be viewed and how effective they are? This question is also related to 527259 .

+4
source share
10 answers

Someone should look at each line of code that changes. If the review has too much code in one change, then you change too much, and you should consider changing the change to a series of small changes.

Not everyone needs to review every change, but every change needs to be reviewed by someone. No one writes perfect code.

+5
source

The parts that you are currently working on.

In addition, parts with the highest error rate (which should be part of those parts that you are currently working on).

+2
source

I always start with parts that are “ugly” in the sense that there is either a small comment or incorrect variable names like xx1, or any other place that decides that it does not want to use encapsulation. It almost always amazes me as places to redefine. After that, I agree with the “most difficult” comment above.

+2
source
  • A code that is very often used in code.
  • Critical business code.

Edit With "Code that is used very often," I mean code that is often used in code. not necessarily code that is often used by the user. There is a big difference, since frequently used code is the goal of change. Now I'm not saying that code cannot be reused. I try to say that when the code is reused. This deserves more attention, and therefore is good to consider.

+1
source

One motivation in a code review is to find bugs. Another way is to provide more developers with parts of your code base that they usually don’t see. This helps train junior coders. It also helps to assure that you don’t have big problems when the developer leaves - because they are the only person who knew how something works.

So:

View the parts of the app that are scary. Especially those parts that you would not dare to work for, or tell the younger one that it does not work.

Older programs often have areas written by developers who no longer work for the company. Often this stuff gets very cruel because new developers won't take the time to figure it out before making changes. Check it out.

See all the code that only one person works on.

Browse all that are really difficult.

+1
source

If a team uses TDD, one code metric you can use is code coverage: a low coverage test class is a good candidate to review.
A tool like NDepend can also help you visualize how complex the various parts of your code base are and what parts depend on them.

+1
source

You can use the code metrics tool and run it against the code base and find the most complex fragments of your project that have been processed recently.

0
source

I usually check the contracts of various classes and methods. Do the methods make sense, are the conditions before and after clearly defined, etc. And I check if there are any obvious code smells ( http://c2.com/xp/CodeSmell.html ). And if TDD is practiced, it’s good to check the tests first, it will give an idea of ​​how the code works, as well as when checking all conditions.

0
source

I would focus on areas that are important to business goals, and then areas that are performance sensitive. For example, if your application is crunching data, look at algorithms that make data reduction for correctness.

0
source

You should encode an overview of areas of code that have been changed in the current development iteration / are case-specific.

eg. how it works for me in the environment where we use Fogbugz: - the fogbugz case is handled by the developer - the developer changes the code, checks for subversion and the changed files are connected to the fogbogz file - the developer assigns a code review - the code browser looks at the files changed for this case / the changes made (listed in the "Checks" list associated with this case) and verifies that the changes made make sense / are correct. - if everything is in order, the code browser marks the case as resolved / completed, another assigns comments to the developer

0
source

All Articles