结对编程第一次作业

一、结对编程
这是我的同伴王文博的conding地址:https://git.dev.tencent.com/dtid_6a25ecbbe432b0b9/jieduibianchengdiyicizuoye.git
二、代码审核表

<head> <meta http-equiv=Content-Type content="text/html; charset=gb2312"> <meta name=ProgId content=Excel.Sheet> <meta name=Generator content="Microsoft Excel 15"> <link rel=File-List href="作业4.files/filelist.xml"> <style id="新建 Microsoft Excel 工作表 (2)_28150_Styles"> <!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";} .font528150 {color:windowtext; font-size:9.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:等线; mso-generic-font-family:auto; mso-font-charset:134;} .xl1528150 {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:等线; mso-generic-font-family:auto; mso-font-charset:134; mso-number-format:General; text-align:general; vertical-align:bottom; mso-background-source:auto; mso-pattern:auto; white-space:nowrap;} .xl6328150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:none; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6428150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:none; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6528150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6628150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6728150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6828150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:none; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl6928150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:none; border-bottom:1.0pt solid silver; border-left:none; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7028150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:none; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7128150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:none; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7228150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:"Short Date"; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:none; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7328150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana, sans-serif; mso-font-charset:0; mso-number-format:"Short Date"; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:none; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7428150 {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:general; vertical-align:bottom; mso-background-source:auto; mso-pattern:auto; white-space:nowrap;} .xl7528150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border-top:1.0pt solid silver; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7628150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7728150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7828150 {color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:left; vertical-align:middle; border:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal; padding-left:12px; mso-char-indent-count:1;} .xl7928150 {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:center; vertical-align:middle; border-top:1.0pt solid silver; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal;} .xl8028150 {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:center; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:none; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal;} .xl8128150 {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:black; font-size:11.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:微软雅黑, sans-serif; mso-font-charset:134; mso-number-format:General; text-align:center; vertical-align:middle; border-top:none; border-right:1.0pt solid silver; border-bottom:1.0pt solid silver; border-left:1.0pt solid silver; background:white; mso-pattern:black none; white-space:normal;} ruby {ruby-align:left;} rt {color:windowtext; font-size:9.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:等线; mso-generic-font-family:auto; mso-font-charset:134; mso-char-type:none;} --> </style> </head> <body> <!--[if !excel]>  <![endif]--> <!--下列信息由 Microsoft Excel 的发布为网页向导生成。--> <!--如果同一条目从 Excel 中重新发布,则所有位于 DIV 标记之间的信息均将被替换。--> <!-----------------------------> <!--“从 EXCEL 发布网页”向导开始--> <!----------------------------->
项目名称 堆排序与桶排序
审查人 徐子健 审查日期 2019/4/25
代码名称 源.cpp 代码作者 王文博
文件结构
序号 审查项目 重要性 结论 备注
1 头文件和定义文件的名称是否合理?   是  
2 头文件和定义文件的目录结构是否合理?   是  
3 版权和版本声明是否完整?   不适用 操作系统课程设计
4 头文件是否使用了 ifndef/define/endif 预处理块? 重要 不适用 未使用自订的头文件
5 头文件中是否只存放“声明”而不存放“定义”?   不适用 未使用自订的头文件
程序版式
序号 审查项目 重要性 结论 备注
6 代码段间的空行是否得体?   是  
7 代码行内的空格是否得体?   是  
8 长行拆分是否得体?   是
9 “{” 和 “}” 是否各占一行并且对齐于同一列?   是
10 一行代码是否只做一件事?如只定义一个变量,只写一条语句。 重要 否 有一行中出现定义多个变量的现象
11 If、for、while、do等语句自占一行,不论执行语句多少都要加 “{}”。 重要 否 有部分判断未加"{}"
12 在定义变量(或参数)时,是否将修饰符 * 和 & 紧靠变量名? 重要 是
13 注释是否清晰并且必要? 重要 否 只介绍了函数功能,没有其他的注释
14 注释是否没有错误且不会导致误解? 重要 是/td>
15 类结构的public, protected, private顺序是否在所有的程序中保持一致? 重要 不适用 没有使用类
命名规则
序号 审查项目 重要性 结论 备注
16 命名规则是否与所采用的操作系统或开发工具的风格保持一致? 重要 是  
17 标识符是否直观且可以拼读?   是  
18 标识符的长度应当符合“min-length && max-information”原则?   是  
19 程序中是否出现相同的局部变量和全部变量? 重要 是 局部变量命名相同
20 类名、函数名、变量和参数、常量的书写格式是否遵循一定的规则?   是  
21 静态变量、全局变量、类的成员变量是否加前缀?   否  
表达式与基本语句 
序号 审查项目 重要性 结论 备注
22 如果代码行中的运算符比较多,是否已经用括号清楚地确定表达式的操作顺 重要 是 乘除运算出现加减法会加上括号
23 是否编写太复杂或者多用途的复合表达式?   否  
24 是否将复合表达式与“真正的数学表达式”混淆? 重要 否  
25 是否用正确的方式写if语句? 例如 重要 是  
1) 将布尔变量直接与TRUE、FALSE或者1、0进行比较。 否  
2) 将浮点变量用“==”或“!=”与任何数字比较。 否 都是整形变量
3) 将指针变量用“==”或“!=”与NULL比较。 否 未使用链表
26 如果循环体内存在逻辑判断,并且循环次数很大,是否已经将逻辑判断移到循环体外面?   否 循环比较简单
27 Case语句的结尾是加了break? 重要 不适用 未使用switch语句
28 是否写了switch的default分支? 重要 不适用 未使用switch语句
29 使用goto 语句时是否留下隐患? 例如跳过了某些对象的构造、变量的初始化,重要的计算等。 重要 不适用 未使用goto语句
常量
序号 审查项目 重要性 结论 备注
30 是否使用含义直观的常量来表示那些将在程序中多次出现的数字或字符串?   是  
31 是否误解了类中的const数据成员?因为const数据成员只在某个对象   不适用 未使用类
32 如果某一常量与其它常量密切相关,是否在定义中包含了这种关系? 重要 是  
33 生存期内是常量,而对于整个类而言却是可变的。   不适用 未使用类
函数设计
序号 审查项目 重要性 结论 备注
34 参数的书写是否完整?不要贪图省事只写参数的类型而省略参数名字。   是  
35 参数命名、顺序是否合理?   是  
36 参数的个数是否太多?   否 只有个位数的参数
37 是否使用类型和数目不确定的参数?   否
38 是否省略了函数返回值的类型?   否 都是整型
39 函数名字与返回值类型在语义上是否冲突?   否  
40 是否将正常值和错误标志混在一起返回?正常值应当用输出参数获得,而错误标志用return语句返回。 重要 否  
41 在函数体的“入口处”,是否用assert对参数的有效性进行检查? 重要 否 未使用assert
42 使用滥用了assert? 例如混淆非法情况与错误情况,后者是必然存在的并且 重要 否 未使用assert
43 return语句是否返回指向“栈内存”的“指针”或者“引用”? 重要 否  
44 是否使用const提高函数的健壮性?const可以强制保护函数的参数、返回值,甚至函数的定义体。“Use const whenever you need”   否 未使用const
内存管理
序号 审查项目 重要性 结论 备注
45 用malloc或new申请内存之后,是否立即检查指针值是否为NULL? 重要 否 未检查指针值是否为NULL
46 是否忘记为数组和动态内存赋初值? 重要 否
47 数组或指针的下标是否越界? 重要 否  
48 动态内存的申请与释放是否配对? 重要 否  
49 是否有效地处理了“内存耗尽”问题? 重要 否 没有出现内存耗尽问题
50 是否修改“指向常量的指针”的内容? 重要 否
51 是否出现野指针?例如 重要  
1) 指针变量没有被初始化 是
2) 用free或delete释放了内存之后,忘记将指针设置为NULL。   否
52 是否将malloc/free 和 new/delete 混淆使用? 重要 否  
53 malloc语句是否正确无误?例如字节数是否正确?类型转换是否正 确? 重要 是  
54 在创建与释放动态对象数组时,new/delete的语句是否正确无误? 重要 不适用 未使用动态对象数组
其它常见问题 
序号 审查项目 重要性 结论 备注
55 数据类型问题: 重要    
1) 变量的数据类型有错误吗? 否  
2) 存在不同数据类型的赋值吗? 否  
3) 存在不同数据类型的比较吗? 否  
56 变量值问题: 重要    
1) 变量的初始化或缺省值有错误吗? 否  
2) 变量发生上溢或下溢吗? 否  
3) 变量的精度够吗? 是  
57 逻辑判断问题: 重要    
1) 由于精度原因导致比较无效吗? 否  
2) 表达式中的优先级有误吗? 否  
3) 逻辑判断结果颠倒吗?  否  
58 循环问题: 重要    
1) 循环终止条件不正确吗? 否  
2) 无法正常终止(死循环)吗? 否 未出现死循环
3) 错误地修改循环变量吗? 否  
4) 存在误差累积吗? 否  
59 错误处理问题: 重要   未编写错误处理程序
1) 忘记进行错误处理吗? 不适用
2) 错误处理程序块一直没有机会被运行? 不适用
3) 错误处理程序块本身就有毛病吗? 不适用
4) 错误处理程序块是“马后炮”吗?如在被它被调用之前软件已经出错。 不适用
60 文件I/O问题: 重要   未对文件进行操作
1) 对不存在的或者错误的文件进行操作吗? 不适用
2) 文件以不正确的方式打开吗? 不适用
3) 文件结束判断不正确吗? 不适用
4) 没有正确地关闭文件吗? 不适用
</body> 三、评价 总的来看,王文博同学写的代码是十分优秀的,基本上没有出现错误,但是人无完人,这次编程还是出现了一些小的失误。 优点: 这次排序算法用了桶排序和堆排序两种算法,相比于传统的快速排序,这两种方法效率更高,例如要统计高考各分值有多少人时,用传统算法的时间要很久,而用桶排序 只需要几秒,而且王文博同学的代码风格十分简洁,便于理解,看起来赏心悦目。 缺点: 缺少代码注释,虽然功能不复杂,但是养成一个好习惯会为自己以后的工作带来便利; 没有对内存做合理的利用; 对变量名称的定义过于随意,不能及时分辨出它的功能。
posted @ 2019-04-25 21:06  YELLOWCARD  阅读(194)  评论(0)    收藏  举报