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

个人博客作业Week2

时间:2015-09-30 23:26:16      阅读:333      评论:0      收藏:0      [点我收藏+]

标签:

代码规范:

 

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

  代码规范的产生并不是由于官僚制度,更不会浪费大家的编程时间,有统一的代码规范,才有程序员们工作的依据,才能提高程序员们工作的效率。也许在自己写程序的时候,代码规范会浪费一定的时间。但在团队工作中,代码规范则是必不可少的东西,有了代码规范才能让整个团队有统一的依据来编写程序,从而提高团队的效率及每个人代码的可读性。

 

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?

calculate类 处理四则运算,各函数较长,可以考虑简化

 

Is the code as modular as possible?

 Main函数的行数很少,说明代码封装的非常漂亮,实现了模块化

 

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/zmxch1306/p/4850414.html

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