My parnter code review

Posted

tags:

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

1.建议修改的代码:

public class Jiemian extends JFrame {
 23 
 24     private JPanel contentPane;
 25     
 26     
 27         private JTextField username;
 28         private JTextField email;
 29         private JPasswordField password;
 30         private JLabel man;

意见:这个类的名字太过随意,可能有时候让人不理解

修改如下:

 22 public class interface extends JFrame {
 23 
 24     private JPanel contentPane;
 25     
 26     
 27         private JTextField username;
 28         private JTextField email;
 29         private JPasswordField password;
 30         private JLabel man;

 

2.建议修改的代码:

150                         switch (n) {
151                    case 0:
152                    JOptionPane.showMessageDialog(button_1,
153                    "用户名:" + name1 + "\n" + "性别:"  xb + "\n" + "电子邮件:"  mail + "\n" + "爱好:" + role1);
154                         }
155             }
156 
157                 }
158             });

意见:大括号的位置随意摆放,凌乱

修改如下:

150                         switch (n) {
151                     case 0:
152                     JOptionPane.showMessageDialog(button_1,
153                     "用户名:" + name1 + "\n" + "性别:" xb + "\n" + "电子邮件:"  mail + "\n" + "爱好:" + role1);
154             }
155         }
156 
157      }
158    });

3.建议修改的代码:

                        switch (n) {
151               case 0:
152               JOptionPane.showMessageDialog(button_1,
153               "用户名:" + name1 + "\n" + "性别:" xb + "\n" + "电子邮件:"  mail + "\n" + "爱好:" + role1);
154                         }
155             }
156 

意见:行的长度,缩进有问题,看着不舒服,还有符号也漏掉了

修改如下:

                             switch (n) {
151                          case 0:
152                             JOptionPane.showMessageDialog(button_1,
153                             "用户名:" + name1 + "\n" + "性别:" + xb + "\n" + "电子邮件:" + mail + "\n" + "爱好:" + role1);
154                         }
155             }
156 

 

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

my code review

My Code Review

my code review

Code Review 规范

[行业关键词] review code review

工程能力代码检查code Review