2020 software engineering pairing operation 1

Blog information Shenyang University of Aeronautics and Astronautics, School of Computer Engineering 2020 Software Engineering
Work requirements https://edu.cnblogs.com/campus/sau/Computer1701-1705/homework/10583
Course objectives Familiar with the development process of a "high quality" software
Homework goal Familiar with code specifications and pair-wise mutual review

1. Companion Information

My partner this time is: Yan Lijing
Her blog homework address: # non-submitted version
Her code address is: mouse click here

2. Review Form

Function module name Connected graph coloring
Examiner Fu Shouxu Review date 2020/4/11
Code name Connected graph coloring Code author Yan Lijing
File structure
Serial number importance Review item in conclusion
1 Are the names of the header and definition files reasonable? Yes
2 Whether the directory structure of header files and definition files is reasonable Yes
3 Whether the copyright and version declarations are complete no
4 important Whether the header file uses ifndef / define / endif preprocessing block no
5 Whether the header file only stores "declaration" but not "definition" no
The format of the program
Serial number importance Review item in conclusion
6 Whether the blank line is decent Yes
7 Whether the space in the code line is decent Yes
8 Whether the long line split is decent Yes
9 "{" And "}" when each line and aligned in the same column Yes
10 important Do only one thing per line of code? If only one variable is defined, write only one statement Yes
11 important Statements such as if, for, while, and do each occupy one line, no matter how many statements are executed, add "{}". Yes
12 important When defining variables (or parameters), are the modifiers * and & next to the variable name? Whether the comments are clear and necessary. Yes
13 important Are there any errors or misunderstandings in the comments? no
14 important Are the public, protected, and private order of the class structure consistent across all programs? no
Naming convention
Serial number importance Review item in conclusion
15 important Is the naming convention consistent with the style of the operating system or development tool used? Yes
16 Is the length of the identifier intuitive and spellable? Yes
17 Should the length of the identifier conform to the "min-length && max-information" principle? Yes
18 important Do the same local variables and all variables appear in the program? no
19 Do class names, function names, variables and parameters, and constants follow certain rules? Yes
20 Are static variables, global variables, and class member variables prefixed? no
Expressions and basic sentences
Serial number importance Review item in conclusion
21 important 如果代码行中的运算符比较多,是否已经用括号清楚地确定表达式的操作顺序?
22 是否编写太复杂或者多用途的复合表达式?
23 重要 是否将复合表达式与“真正的数学表达式”混淆?
24 重要 是否用隐含错误的方式写if语句? 例如
1)将布尔变量直接与TRUE、FALSE或者1、0进行比较。
2)将浮点变量用“==”或“!=”与任何数字比较。
3)将指针变量用“==”或“!=”与NULL比较。
如果循环体内存在逻辑判断,并且循环次数很大,是否已经将逻辑判断移到循环体的外面?
25 重要 Case语句的结尾是否忘了加break?
26 重要 是否忘记写switch的default分支?
27 重要 使用goto 语句时是否留下隐患? 例如跳过了某些对象的构造、变量的初始化、重要的计算等。
常量
序号 重要性 审查项 结论
28 是否使用含义直观的常量来表示那些将在程序中多次出现的数字或字符串?
29 重要 在C++ 程序中,是否用const常量取代宏常量?
30 如果某一常量与其它常量密切相关,是否在定义中包含了这种关系?
31 是否误解了类中的const数据成员?因为const数据成员只在某个对象
32 生存期内是常量,而对于整个类而言却是可变的。
函数设计
序号 重要性 审查项 结论
33 参数的书写是否完整?不要贪图省事只写参数的类型而省略参数名字。
34 参数命名、顺序是否合理?
35 参数的个数是否太多?
36 是否使用类型和数目不确定的参数?
37 是否省略了函数返回值的类型?
38 函数名字与返回值类型在语义上是否冲突?
39 是否将正常值和错误标志混在一起返回?正常值应当用输出参数获得,而错误标志用return语句返回。
40 重要 在函数体的“入口处”,是否用assert对参数的有效性进行检查?
41 重要 使用滥用了assert? 例如混淆非法情况与错误情况,后者是必然存在的并且是一定要作出处理的。
42 重要 return语句是否返回指向“栈内存”的“指针”或者“引用”?
43 重要 是否使用const提高函数的健壮性?const可以强制保护函数的参数、返回值,甚至函数的定义体。“Use const whenever you need”
内存管理
序号 重要性 审查项 结论
44 重要 用malloc或new申请内存之后,是否立即检查指针值是否为NULL?(防止使用指针值为NULL的内存)
45 重要 是否忘记为数组和动态内存赋初值?(防止将未被初始化的内存作为右值使用)
46 重要 数组或指针的下标是否越界?
47 重要 动态内存的申请与释放是否配对?(防止内存泄漏)
48 重要 是否有效地处理了“内存耗尽”问题?
49 重要 是否修改“指向常量的指针”的内容?
50 重要 是否出现野指针?例如(1)指针变量没有被初始化;(2)用free或delete释放了内存之后,忘记将指针设置为NULL。
51 重要 是否将malloc/free 和 new/delete 混淆使用?
52 重要 malloc语句是否正确无误?例如字节数是否正确?类型转换是否正确?
53 重要 在创建与释放动态对象数组时,new/delete的语句是否正确无误?
C++函数的高级特性
序号 重要性 审查项 结论
54 重载函数是否有二义性?
55 重要 是否混淆了成员函数的重载、覆盖与隐藏?
56 运算符的重载是否符合制定的编程规范?
57 是否滥用内联函数?例如函数体内的代码比较长,函数体内出现循环。
58 重要 是否用内联函数取代了宏代码?
类的构造函数、析构函数和赋值函数
序号 重要性 审查项 结论
59 重要 是否违背编程规范而让C++ 编译器自动为类产生四个缺省的函数:
重要 (1)缺省的无参数构造函数;
重要 (2)缺省的拷贝构造函数;
重要 (3)缺省的析构函数;
重要 (4)缺省的赋值函数。
60 重要 构造函数中是否遗漏了某些初始化工作?
61 重要 是否正确地使用构造函数的初始化表?
62 重要 析构函数中是否遗漏了某些清除工作?
63 是否错写、错用了拷贝构造函数和赋值函数?
64 重要 赋值函数一般分四个步骤:
(1)检查自赋值;
(2)释放原有内存资源;
(3)分配新的内存资源,并复制内容;
(4)返回 *this。是否遗漏了重要步骤
65 重要 是否正确地编写了派生类的构造函数、析构函数、赋值函数?
66 注意事项:
(1)派生类不可能继承基类的构造函数、析构函数、赋值函数。
(2)派生类的构造函数应在其初始化表里调用基类的构造函数。
(3)基类与派生类的析构函数应该为虚(即加virtual关键字)。
(4)在编写派生类的赋值函数时,注意不要忘记对基类的数据成员重新赋值
类的高级特性
序号 重要性 审查项 结论
67 重要 是否违背了继承和组合的规则?
(1)若在逻辑上B是A的“一种”,并且A的所有功能和属性对B而言都有意义,则允许B继承A的功能和属性。
(2)若在逻辑上A是B的“一部分”(a part of),则不允许B从A派生,而是要用A和其它东西组合出B。
其他常见问题
序号 重要性 审查项 结论
68 重要 数据类型问题:
(1)变量的数据类型有错误吗?
(2)存在不同数据类型的赋值吗?
(3)存在不同数据类型的比较吗?
69 重要 变量值问题:
(1)变量的初始化或缺省值有错误吗?
(2)变量发生上溢或下溢吗?
(3)变量的精度够吗?
70 重要 循环问题:
(1)循环终止条件不正确吗?
(2)无法正常终止(死循环)吗?
(3)错误地修改循环变量吗?
(4)存在误差累积吗?
71 重要 错误处理问题:
(1)忘记进行错误处理吗?
(2)错误处理程序块一直没有机会被运行?
(3)错误处理程序块本身就有毛病吗?如报告的错误与实际错误不一致,处理方式不正确等等?
(4)错误处理程序块是“马后炮”吗?如在被它被调用之前软件已经出错?
72 重要 文件I/O问题:
(1)对不存在的或者错误的文件进行操作吗?
(2)文件以不正确的方式打开吗?
(3)文件结束判断不正确吗?
(4)没有正确地关闭文件吗?

三、对同伴代码的评价:

我本次审查的代码题目是连通图着色。我的伙伴闫力菁的代码总体来说比较规范,清晰易懂,比较好。

优点:

  (1)注释详细,代码书写规范,我在Visual Studio 2019上观看,代码间的空格使用的特别好,非常养眼。
  (2)整体性特别好,一个主函数外加多个功能函数,清晰易懂。
  (3)很多地方用到了功能函数,而不是全部放到主函数main中。
  (4)变量命名较为合理,能够比较清晰的识别出变量的含义。
  (5)各个函数功能明确,设置合理,功能丰富

缺点:

  (1)界面设计上还是不够友好,非专业人士难以上手。
  (2)在用switch函数时,忘记使用了default语句,容易导致一些问题和错误。
  (3)没有错误处理函数,在出现异常或者错误时不能有反馈。
  (4)未使用类,没有使用面向对象的思想去解决问题。
  (5)个别函数里有一些变量名不合理。

Guess you like

Origin www.cnblogs.com/fsx-zzc/p/12682892.html