个人作业--week3

1. 软件工程师的成长

同学们在上这门课的时候,还是大三,你的困难和迷茫,别人一定有过。请看看别人怎么学习的,有些是科班,有些是野路子,有些成功,有些失败。 请读完下面所有博客(也可以再读一些你觉得有意思的博客),谈谈自己的感想,你现在的条件比他们如何?你对计算机的热爱仅仅是口头的么?IT专业的技术道路,职业道路,社会道路怎么计划呢?

其实在读大学之前,我并没有接触过编程这方面的知识,选择计算机专业也是一件十分阴差阳错的事情。刚开始学习编程的时候,没有基础的我和那些搞ACM的大神比起来好弱啊,做作业都很吃力,而且经常得知自己一些在二本,三本读计算机的同学,看起来付出的努力也没有那么多,但是他们的水平似乎比我不知要高到哪里去,他们已经可以写很长的代码,做一个看起来相对庞大的工程了,而我还在纠结于每次的作业完不成。导致我一度陷入了迷茫,不知道自己辛辛苦苦这么久到底有什么用。但是越到后来越发现速成的写代码本领和一步一个脚印慢慢学到的知识还是不一样的,对一些原理,算法什么的,了解的也更透彻。

当写代码越来越熟练的时候,也越来越能体会到其中的成就感,越来越觉得写代码是一件很开心的事情。未来打算读研之后再去工作,毕竟把自身的技术提升上去才能真正成为自己想象中的大神。 

2. 代码复审

每位同学复审其结对编程的伙伴的个人项目,并写一个个人博客报告复审结果

General

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

◦                     Yes.

  • 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?

◦                     Yes.

  • Is the code as modular as possible?

◦                     Yes.

  • Can any global variables be replaced?

◦                     Yes.

  • Is there any commented out code?

◦                     Yes.

  • Do loops have a set length and correct termination conditions?

◦                     Yes.

  • Can any of the code be replaced with library functions?

◦                     Yes.

  • Can any logging or debugging code be removed?

◦                     No.

Security

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

◦                     Yes.

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

◦                     No.

  • Are output values checked and encoded?

◦                     No.

  • 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?

◦                     Yes.

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

◦                     Yes.

  • 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?

◦                     No.

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

◦                     No.

 

值得学习和借鉴的优点:

1.将一些小型的工具函数从代码中分离出来,例如一些求站点所在路线,某条线路中所有站点这种实现简单但是应用频率较高的功能写成函数,能有效的减短代码长度,使代码结构看起来更加的清晰。

2.代码格式规范统一,代码思路清晰,注释量很大,可读性强。不仅为其他人阅读代码提供了便利,同时也能使自己在写程序时思路清晰,不易混乱。

3.整体架构设计很清晰,很容易理解,采用了地图-->线路-->站点这样的三级结构,即一个地图中包括多条线路,一条线路中包括多条站点。

个人不太推荐的方面:

结对编程的同学把所有的代码写在一个文件中,进行代码复审的时候需要不停的上下滑动,麻烦而且容易混乱。

原文地址:https://www.cnblogs.com/hanhuimin/p/5926493.html