First, the members of the blog twinning link address
Li Gao cold classmates :
Second, the code review checklist
content |
Wei one person |
Li Yang |
|
1. Summary section |
1 ) comply with the code requirements and specifications it? |
meets the |
meets the |
2 ) whether the code design thoughtful? |
Yes |
Yes |
|
3 How) code readability |
High readability, there are enough comments |
High readability, clear logic |
|
4 ) the code easier to maintain it? |
Code written from top to bottom will help maintain the late |
Easy to maintain |
|
5 Each line execution) code and check it, huh? |
Yes |
Yes |
|
2. Design Specification |
1 whether) designed to comply with known design patterns or items commonly used mode |
Yes |
Yes |
2) There are no hard-coded or strings or numbers, etc. exist ? |
Have |
Have |
|
3) code is not dependent on a particular platform, whether it will affect the future of transplantation ( such as Win32 to Win 64-)? |
Do not rely on platform
no |
Do not rely on platform
no |
|
4) developers write new code to be able to use the existing realize the function Library / SDK / Framework in? Whether there is a similar function can be called without having to re-implement all ? |
No
no |
No
no |
|
5) There is no unused code can be cleared ? ( A lot of people want to keep as much code as possible in the future will spend, This results in the program file has a lot of code commented out, these codes can be deleted, because the source code control has saved the original old code. |
No |
No |
|
3. Code Specification |
Modify the code in line with standard parts and style it ( the detailed provisions omitted )? |
meets the |
meets the |
4. DETAILED code portion |
1) There is no error processing ? For external function call, check the return value or exception handling ? |
There error processing and exception handling |
There are errors, checks the return value |
2) parameters passed with no errors, the length of the string length byte or character ( may be a single 1 -byte ) length, Is 0 start counting or with 1 start counting ? |
No error From 0 to start |
No; 0 from the start |
|
3) how the boundary conditions are treated ? Switch statement default how branches are handled ? Cycle there is no possible infinite loop ? |
On the first boundary condition is specified at the beginning; When default is not a branch, if the condition is not satisfied Case , ends the Switch ; It will not be an endless loop. |
先确定边界条件是什么,没有default分支时,无满足条件语句直接跳出switch语句,不会出现死循环。 |
|
4)有没有使用断言( Assert)来保证我们认为不变的条件真的得到满足? |
没有 |
没有 |
|
5)对资源的利用,是在哪里申请,在哪里释放的?有无可能存在资源泄漏(内存、文件、 各种GUI资源、数据库访问的连接,等等) ?有没有优化的空间? |
申请全局变量,在程序运行完后释放掉;无动态申请资源的地方,资源全部限制在函数或者类的局部范围之内不会出现资源泄露的情况。 |
申请全局变量,在程序运行完后释放掉; 有限次申请,所以可能不会导致资源泄露。 |
|
6)数据结构中有没有用不到的元素? |
无无用元素 |
没有无用元素 |
|
5.效能 |
1)代码的效能( Performance )如何? |
效能较好
|
效能较好
|
2)代码中,特别是循环中是否有明显可优化的部分(C++中反复创建类,C#中string的操作是否能StringBuilder来优化) ? |
否 |
否 |
|
3)对于系统和网络的调用是否会超时?如何处理? |
否 |
没有相关调用 |
|
6.可读性 |
代码可读性如何?有没有足够的注释? |
可读性高,有足够注释 |
可读性高,有足够注释 |
7.可测试性 |
代码是否需要更新或创建新的单元测试?针对特定领域的开发(如数据库、网页、多线程等),可以整理专门的核查表。 |
是
没有上述要求 |
是
无此需求 |
三、代码编写基本规范
1、基本要求
(1).每行80个字数限制,每一行尽量不要超过80个字符,超出后进行回车排版,方法名的冒号要对齐。
(2).行宽限定为100字符。
2、命名规范
(1).类命名:首字母大写,每个单词首字母大写(大驼峰命名法),尽量使用能够反映类功能的名词短语,例:UserManage ,UserData等。
(2).方法名:首字母小写,剩余的每个单词的首字母大写(小驼峰命名法)。
(3).变量名:首字母小写,之后每个单词首字母都大写,具有足够的说明性,成员变量不需要添加“_”前缀,成员变量添加“_”前缀。
3、注释要求
(1).在方法内部注释的地方使用//即可。
(2).复杂的注释要放在类头,并且注释要随着程序的修改而不断更新。
4、方法函数要求
(1).一个函数必须限制在50行左右(如果需要来回滚动眼球或代码才能看全一个方法,就会很影响思维的连贯性,对阅读代码的速度造成比较大的影响。最好的情况是在不滚动眼球或代码的情况下一眼就能将该方法的全部代码映入眼帘。)
(2).单一原则:每个函数的职责都应该划分的很明确(就像类一样)。
5、核心原则
(1).代码简洁易懂,逻辑清晰。
(2).面向变化编程而非面向需求编程,因为需求是暂时的,代码要利于根据需求变化。
(3).先保证程序的正确性,以防开始时就过度考虑代码的扩展性。
四、结对编程的感受
优点:
1.我认为结对编程的编程效率会比个人编程高,而且互相鼓励,不容易沮丧:团队工作能增加成员的工作积极性。因为在面对问题的时候,会有人一起分担,共同尝试新的策略。
2.互相监督,不容易偷懒:两个人一起工作需要互相配合,如果想偷懒去干别的,就会拖延工作进度。
3.互相学习编程技巧:在编程中,相互讨论,可以更快更有效地解决问题,互相请教对方,可以得到能力上的互补。
缺点
1.两个人想法不同的时候容易产生争执。
2.写代码习惯不一样,容易产生有的地方看不懂的情况。
综上所述,结对编程”优点还是多于缺点,结对编程对学习和锻炼自己都是很好的方式途径,但在学习合作中也要结对编程的时间需要合理安排。
五、结对场景照片
六、项目设计说明
1.设计目标
本次四则运算的程序设计,通过java编写能够完成四则运算的各个功能,利用面向对象的程序设计的思想,将各个组件的事件响应用不同的方式表现出来。
2.设计流程
(1).分析四则运算需要完成的功能
(2).考虑异常处理
(3).编码实现各个功能
七、Github链接地址
github链接地址:https://github.com/20194652WYR/WL