码迷,mamicode.com
首页 > 其他好文 > 详细

个人博客作业-Week2 (代码规范, 代码复审)

时间:2015-09-29 22:08:12      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

代码规范:

1.这些规范都是官僚制度下产生的浪费大家的编程时间、影响人们开发效率, 浪费时间的东西。

 编码规范它包含了代码格式,还包括了编码风格和其他规范,通常涉及:缩进、空格使用、Tab使用

   注释、命题习惯、代码行长度和语言特点风格,从而使大家能够很方便得互相阅读对方的代码从而促进

   团队中的沟通与交流。不是浪费时间。

2.我是个艺术家,手艺人,我有自己的规范和原则。

  艺术家的表现层次如果只是在规范上面,显然不是个优秀的艺术家,通过大家都容易接受的方式可以

     让自己的创造力更好得表现出来。

3.规范不能强求一律,应该允许很多例外。

  我觉得只要不是什么太苛刻得规范,还是尽量做到一律吧,起码别人看起来不会产生情绪。

4.我擅长制定编码规范,你们听我的就好了。

  要结合大家的特点,不能仅仅是依靠个人的习惯。

代码复审:

这是我给结对组同学的代码复审表。

General

Does the code work? Does it perform its intended function, the logic is correct etc.

 程序能正常运行,各个功能都完整。

Is all the code easily understood?

 代码结构清晰,好好儿解释代码。

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?

Generate和Compute函数的功能很多了,这两个函数可以在模块化一些。

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?

正常结束

Can any of the code be replaced with library functions?

可以用到库函数

Can any logging or debugging code be removed?

 没有的

Security

Are all data inputs checked (for the correct type, length, format, and range) and encoded?

都做到了

Where third-party utilities are used, are returning errors being caught?

 未使用

Are output values checked and encoded?

 都正确

Are invalid parameter values handled?

 输入错的话不进行,并结束程序

Documentation

Do comments exist and describe the intent of the code?

 没有写文档

Are all functions commented?

 没有写文档

Is any unusual behavior or edge-case handling described?

 没有写文档

Is the use and function of third-party libraries documented?

 没有写文档

Are data structures and units of measurement explained?

 没有写文档

Is there any incomplete code? If so, should it be removed or flagged with a suitable marker like ‘TODO’?

 没有写文档

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?

 没有设计测试代码

Are arrays checked for ‘out-of-bound’ errors?

 没有进行数组越界检查

Could any test code be replaced with the use of an existing API?

 没有设计测试代码

个人博客作业-Week2 (代码规范, 代码复审)

标签:

原文地址:http://www.cnblogs.com/ockjh/p/4847335.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!