个人作业—Week3
Posted chengfr
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了个人作业—Week3相关的知识,希望对你有一定的参考价值。
代码复审
我对我的搭档陈鸿超同学的第一次作业进行了复审:
首先根据http://blog.fogcreek.com/increase-defect-detection-with-our-code-review-checklist-example/提供的Code Review Checklist进行评价
General
- Does the code work? Does it perform its intended function, the logic is correct etc.
- Is all the code easily understood?
- Yes
- Does it conform to your agreed coding conventions? These will usually cover location of braces, variable and function names, line length, indentations, formatting, and comments.
- 命名规范性上总体做的不错,但还可以提升。程序中的类成员函数,变量,以及局部,全局变量都是使用驼峰法进行命名,个别变量没有遵循该规则。
- Is there any redundant or duplicate code?
- No
- Is the code as modular as possible?
- 程序中的部分功能模块做到了封装,顶层内容还可以进一步封装
- Can any global variables be replaced?
- 几乎不存在全局变量,但对顶层内容进行封装后可以避免全局变量的存在
- Is there any commented out code?
- 存在被注释掉的函数
- Do loops have a set length and correct termination conditions?
- Yes
- Can any of the code be replaced with library functions?
- 大概是没有
- Can any logging or debugging code be removed?
- No
Security
- Are all data inputs checked (for the correct type, length, format, and range) and encoded?
- Yes
- Where third-party utilities are used, are returning errors being caught?
- No
- Are output values checked and encoded?
- Yes?
- Are invalid parameter values handled?
- No
Documentation
- Do comments exist and describe the intent of the code?
- Yes
- Are all functions commented?
- 主要功能函数均有注释
- Is any unusual behavior or edge-case handling described?
- No
- Is the use and function of third-party libraries documented?
- No
- Are data structures and units of measurement explained?
- Yes
- Is there any incomplete code? If so, should it be removed or flagged with a suitable marker like ‘TODO’?
- No
Testing
- Is the code testable? i.e. don’t add too many or hide dependencies, unable to initialize objects, test frameworks can use methods etc.
- 如果完成顶层的封装,将更利于测试
- Do tests exist and are they comprehensive? i.e. has at least your agreed on code coverage.
- 工程文件中不存在单元测试项目
- Do unit tests actually test that the code is performing the intended functionality?
- No
- Are arrays checked for ‘out-of-bound’ errors?
- Yes
- Could any test code be replaced with the use of an existing API?
- No
以上是关于个人作业—Week3的主要内容,如果未能解决你的问题,请参考以下文章