首页 > 代码库 > code review(互审)

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(互审)