code review(互审)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了code review(互审)相关的知识,希望对你有一定的参考价值。

搭档代码的评审

package Question;

public class Q2 {
    private int maxRevolution;
    private int Revolution;
    private int gears;
    private double dia;
    private String colour;
    private String state;

    public Q2() {

    }
    
    

    public Q2(int maxRevolution, int revolution, int gears, double dia, String colour, String state) {
        super();
        this.maxRevolution = maxRevolution;
        Revolution = revolution;
        this.gears = gears;
        this.dia = dia;
        this.colour = colour;
        this.state = state;
    }



    public int getMaxRevolution() {
        return maxRevolution;
    }

    public void setMaxRevolution(int maxRevolution) {
        this.maxRevolution = maxRevolution;
    }

    public int getRevolution() {
        return Revolution;
    }

    public void setRevolution(int revolution) {
        Revolution = revolution;
    }

    public int getGears() {
        return gears;
    }

    public void setGears(int gears) {
        this.gears = gears;
    }

    public double getDia() {
        return dia;
    }

    public void setDia(double dia) {
        this.dia = dia;
    }

    public String getColour() {
        return colour;
    }

    public void setColour(String colour) {
        this.colour = colour;
    }

    public String isState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }
    
    

    @Override
    public String toString() {
        return "Fan [maxRevolution=" + maxRevolution + ", Revolution=" + Revolution + ", gears=" + gears + ", dia="
                + dia + ", colour=" + colour + ", state=" + state + "]";
    }



    public static void main(String[] args) {

        Q2 status = new Q2();
        
        System.out.println(status);
    }
}

1.类名没有规范命名,随意命名没有意义

2.方法的名称也是随意命名的

3.没有注释

4.部分定义的变量难以理解

5.实例化对象,没有设值,mian方法执行的语句为空值,没有意义

以上是关于code review(互审)的主要内容,如果未能解决你的问题,请参考以下文章

[行业关键词] review code review

工程能力代码检查code Review

Why review code?(为什么要复盘代码)

前端 Code Review 指北

代码审查清单 Code Review

项目管理系列--好用的代码评审(Code Review)工具