个人作业-Week3:代码复审
1.成长之路
14年夏,高考结束,我报了北航的计算机专业,由此踏上了成为程序员的道路。相比众多大神从中学甚至小学就开始的编程人生,我接触编程的日子还很短暂。两年的时间,也许还不足以让自己变得多么厉害,但比起当初那个什么都不懂的自己如今已经有不小的进步了,更重要的是,两年的时间让我确定了自己对编程的热爱,让我确定了当初的选择没有错,也确定了自己将会一直在这条路上走下去。
由于经历有限我也没太多可说的话。两年间,除了正常的课业外花费最多精力的就是ACM竞赛,也从这个竞赛中收获了无数痛苦和快乐,不过肯定还是快乐占了大多数,有时候甚至在想如果中学的时候就能为了信息学竞赛而奋斗该有多么幸福。
以后的路上,当然也不可能放弃ACM,不过也想接触一下更广阔的世界,体会一下做工程和做研究是什么样的感受。也没太多可说的话,姑且就这样吧。
2.代码复审
复审对象:冯炜韬
Code Review Checklist
General
- Does the code work? Does it perform its intended function, the logic is correct etc.
I tested the cases below, the function of -a and -b are correct in all cases. However, there's bug in the function of -c.
终点 最少站数 最少换乘数 最少换乘下的
最少站数
霍营 马泉营 7 1 7 阜通 天通苑南 5 2 8 T2航站楼 南锣鼓巷 6 2 6 灵境胡同 七里庄 9 1 13 阜成门 马泉营 15 2 15 园博园 石榴庄 14 1 14 奥体中心 天安门西 11 2 11 望京西 南邵 11 1 12 西二旗 青年路 16 2 16 四惠东 天通苑南 15 1 20 四惠东 沙河高教园 22 3 23 郭庄子 巩华城 19 3 22 三元桥 土桥 20 2 20 荣京东街 南礼士路 18 2 19 南礼士路 来广营 16 3 21 奥林匹克公园 T2航站楼 9 2 9 篱笆房 和平门 18 3 19 沙河 沙河高教园 1 0 1 平西府 西单 13 2 15 关庄 军事博物馆 15 2 19 梨园 回龙观 25 3 25 天宫院 枣营 28 2 30 良乡南关 管庄 36 3 36 石榴庄 大井 11 1 11 安华桥 后沙峪 13 1 15 立水桥 菜市口 15 1 16 磁器口 良乡南关 26 2 26 In the last case, the program give a wrong route in mode -c. The result is shown below:
- The upper is right and lower is wrong.
- 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. --Yes.
- Is there any redundant or duplicate code? --No.
- Is the code as modular as possible? --Almost.
- Can any global variables be replaced? --Maybe only one variable: subway_machine sm.
- Is there any commented out code? --Yes, but not much.
- Do loops have a set length and correct termination conditions? --Yes.
- Can any of the code be replaced with library functions? --I don't think there's any.
- Can any logging or debugging code be removed? --Yes.
Security
- Are all data inputs checked (for the correct type, length, format, and range) and encoded? --No.
- Where third-party utilities are used, are returning errors being caught? --Yes.
- Are output values checked and encoded? --Yes.
- Are invalid parameter values handled? --Yes.
Documentation
- Do comments exist and describe the intent of the code? --No.
- Are all functions commented? --No.
- 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? --No.
- 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. --Yes.
- Do tests exist and are they comprehensive? i.e. has at least your agreed on code coverage. --No.
- Do unit tests actually test that the code is performing the intended functionality? --Yes.
- Are arrays checked for ‘out-of-bound’ errors? --Most but not all.
- Could any test code be replaced with the use of an existing API? --No.