复审代码为C语言代码,过程式的实现了需求。
代码文件为共计620行的单文件,代码中使用多个函数封装了执行过程中的多种操作。
代码可读性较好,变量名就比较清晰的含义,缩进、括号位置、Tab/空格均保持一致。
代码精炼,没有多余的内容。
代码中也存在问题:
1.作为一个工程化项目,单文件的方式有欠考虑。
2.代码中的部分变量名,如son和mo,不便于理解。
3.没有模测试,仅能通过结果测试程序是否正确。
4.没有注释。
复审结果如下:(其中N/A代表无效项)
General | ||
Does the code work? Does it perform its intended function, the logic is correct etc. | Y | |
Is all the code easily understood? | Y | |
Does it conform to your agreed coding conventions? | N/A | |
Is there any redundant or duplicate code? | N | |
Is the code as modular as possible? | Y | |
Can any global variables be replaced? | Y | |
Is there any commented out code? | N | |
Do loops have a set length and correct termination conditions? | N | |
Can any of the code be replaced with library functions? | N | |
Can any logging or debugging code be removed? | N | |
Security | ||
Are all data inputs checked (for the correct type, length, format, and range) and encoded? | N | |
Where third-party utilities are used, are returning errors being caught? | N/A | |
Are output values checked and encoded? | Y | |
Are invalid parameter values handled? | N | |
Documentation | ||
Do comments exist and describe the intent of the code? | N | |
Are all functions commented? | N | |
Is any unusual behavior or edge-case handling described? | N | |
Is the use and function of third-party libraries documented? | N/A | |
Are data structures and units of measurement explained? | N/A | |
Is there any incomplete code? If so, should it be removed or flagged with a suitable marker like ‘TODO’? | N | |
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. | Y | |
Do tests exist and are they comprehensive? i.e. has at least your agreed on code coverage. | N | |
Do unit tests actually test that the code is performing the intended functionality? | N | |
Are arrays checked for ‘out-of-bound’ errors? | N | |
Could any test code be replaced with the use of an existing API? | N |
原文:http://www.cnblogs.com/-OwO-/p/4840821.html