Software engineering fifth operation (twinning operations)

Original link: http://www.cnblogs.com/1148510216yong/p/8824540.html

Software Engineering Fifth jobs

topic

    本次作业我与合作伙伴选择的是题目1:四则运算生成
  • It can automatically generate four arithmetic exercises
  • The number of items can be customized
  • The user can select an operator
  • Set the maximum number of users (e.g., ten or less, less than one hundred, etc.)
  • Users choose whether to have brackets, if there is a fractional
  • Users select the output (e.g. output to a file, printer, etc.)
  • Desirable to provide a graphical user interface (selected according to their ability to do, in order to implement the above functions mainly)

Select role

  • Driver
    - all the code to complete the work, the basic program requirements to achieve full functionality, and code is uploaded to coding.net or GitHub code hosting system
    - able to give an objective evaluation of the navigator played in this role the programming work, and completed more than 500 word summary
  • Pilot
    - able to assist the driver to complete the work of all the code, and the appropriate choice of standard design test cases for covering the key functions, and code unit to be automatically performed tests
    - for this work can be carried out according to the driver code for the last job checklist evaluation
    - the ability to complete more than 500 word summary of this work
    after discussion with my partner, for me as a pilot.

    Photos cooperation

    925165-20180414195112222-1201569082.jpg

Code Testing

  • Completion code: Coding
  • Details: http: //www.cnblogs.com/BBchao/p/8810276.html
  • Testing the key function unit
    for generating the four arithmetic functions generate test unit design, design test coverage determination code is as follows:

@Test
public void testGenerate() throws Exception {
//TODO: Test goes here...
    long expectd=1,actual=0;
    String s = null;
    s=generate('*',"int",100);
    if(s!=""&&s!="error")actual=1;
    Assert.assertEquals(expectd,actual);
}
@Test
public void testGenerate1() throws Exception {
//TODO: Test goes here...
        long expectd=1,actual=0;
        String s = null;
        s=generate('-',"float",100);
        if(s!=""&&s!="error")actual=1;
        Assert.assertEquals(expectd,actual);
}
@Test
public void testGenerate2() throws Exception {
//TODO: Test goes here...
    long expectd=1,actual=0;
    String s = null;
    s = generate('-',"double",100);
    if(s=="error")actual=1;
    Assert.assertEquals(expectd,actual);
}

Test Success:
925165-20180413214653876-359838023.png
Detailed test code: Coding

  • Design code review form
importance level Check Item result
total    
name     
important 20 Naming rules are consistent with the specifications adopted? Y
  20 Did you follow the principle of the minimum length of a maximum of information? Y
important 50 has / can / function is prefixed whether to return a Boolean? N
Note     
important 10 注释是否较清晰且必要? N
重要 10 复杂的分支流程是否已经被注释? N
    10 距离较远的}是否已经被注释? N
    10 非通用变量是否全部被注释? N
重要 50 函数是否已经有文档注释?(功能、输入、返回及其他可选) N
    10 特殊用法是否被注释? N
声明、空白、缩进    
    20 每行是否只声明了一个变量?(特别是那些可能出错的类型) Y
重要 40 变量是否已经在定义的同时初始化? Y
重要 40 类属性是否都执行了初始化? Y
  20 代码段落是否被合适地以空行分隔? Y
  20 是否合理地使用了空格使程序更清晰? N
  20 代码行长度是否在要求之内? Y
  20 折行是否恰当? Y
语句/功能分布/规模     
  20 包含复合语句的{}是否成对出现并符合规范? Y
  20 是否给单个的循环、条件语句也加了{}? Y
  20 if/if-else/if-else if-else/do-while/switch-case语句的格式是否符合规范? Y
  40 单个变量是否只做单个用途? Y
重要 20 单行是否只有单个功能?(不要使用;进行多行合并) Y
重要 40 单个函数是否执行了单个功能并与其命名相符? Y
  20 操作符++和— —操作符的应用是否复合规范? Y
规模      
重要 20 单个函数不超过规定行数? N
重要 100 缩进层数是否不超过规定? Y
重要 100 是否已经消除了所有警告? Y
重要 40 常数变量是否声明为final? N
重要 80 对象使用前是否进行了检查? N
重要 80 局部对象变量使用后是否被复位为NULL? N
重要 70 对数组的访问是否是安全的?(合法的index取值为[0, MAX_SIZE-1])。 Y
重要 20 是否确认没有同名变量局部重复定义问题? Y
  20 程序中是否只使用了简单的表达式? Y
重要 20 是否已经用()使操作符优先级明确化? N
重要 20 所有判断是否都使用了(常量==变量)的形式? N
  80 是否消除了流程悬挂? Y
重要 80 是否每个if-else if-else语句都有最后一个else以确保处理了全集? Y
重要 80 是否每个switch-case语句都有最后一个default以确保处理了全集? Y
  80 for循环是否都使用了包含下限不包含上限的形式?(k=0; k<MAX) Y
重要 40 XML标记书写是否完整,字符串的拼写是否正确? Y
  40 对于流操作代码的异常捕获是否有finally操作以关闭流对象? N
  20 退出代码段时是否对临时对象做了释放处理? N
重要 40 对浮点数值的相等判断是否是恰当的?(严禁使用==直接判断) Y
可靠性(函数)           
重要 60 入口对象是否都被进行了判断不为空? N
重要 60 入口数据的合法范围是否都被进行了判断?(尤其是数组) N
重要 20 是否对有异常抛出的方法都执行了try...catch保护? Y
重要 80 是否函数的所有分支都有返回值? N
重要 50 int的返回值是否合理?(负值为失败,非负值成功) Y
  20 对于反复进行了int返回值判断是否定义了函数来处理? N
  60 关键代码是否做了捕获异常处理? Y
重要 60 是否确保函数返回CORBA对象的任何一个属性都不能为null? Y
重要 60 是否对方法返回值对象做了null检查,该返回值定义时是否被初始化? N
重要 60 是否对同步对象的遍历访问做了代码同步? N
重要 80 是否确认在对Map对象使用迭代遍历过程中没有做增减元素操作? N
重要 60 线程处理函数循环内部是否有异常捕获处理,防止线程抛出异常而退出? Y
  20 原子操作代码异常中断,使用的相关外部变量是否恢复先前状态? Y
重要 100 函数对错误的处理是恰当的? Y
可维护性           
重要 100 实现代码中是否消除了直接常量?(用于计数起点的简单常数例外) Y
  20 是否消除了导致结构模糊的连续赋值?(如a= (b=d+c )) Y
  20 是否每个return前都要有日志记录? N
  20 是否有冗余判断语句?(如:if (b) return true; else return false;) N
  20 是否把方法中的重复代码抽象成私有函数? Y
  • 对驾驶员的评价
    驾驶员编写代码时思维敏捷,能够很好的想出解决问题的办法,但是经过后期代码审查也发现了代码的不足之处。比如关键函数、关键变量、输入输出变量缺少注释。对于其他的人来说进行代码阅读可能就会出现问题。总的来说驾驶员变现还是很不错的,有很多值得学习的地方。

总结

  The job title is generated four operations, we designed the program can make a demand supply four binary arithmetic. Arithmetic operation can be selected, the number of topics can be customized, can choose whether there is a decimal, the range of the maximum number may be provided, can generate output file with four arithmetic operations. Basically completed the questions asked.
  Through this partnership with the cooperation of pair programming, we learn from each other adjustments, write efficient conduct of the proceedings. Let us have a better understanding of the junction and understanding of the concepts of programming. The process of cooperation is full of happy, so that the original programming activities become boring for us to enjoy the process. We brainstorm with each other, so we want to solve the problem more clearly. Mutual supervision, mutual learning and constantly transmitting their experience, so we have a new understanding of each other's advantages and its shortcomings. For example, we are familiar with the characteristics of each IDE, we share each other shortcut keys. Programming two people together, make the code more standardized, reducing the difficulty of code review.
  For this knot programming experience I think there is some lack, pair programming, we do not change roles. There may be a problem of over-thinking leads to thinking of negligence, not comprehensive enough. Twinning program time is short, not experience significantly different stages of the two cooperation. I feel directly to the stage of creation. Hope in the future of the learning process have the opportunity to properly experience the various stages of pair programming. Pair programming is sometimes chat about off-topic, and then will return to the topic in. I think this is the only thing we encounter it, most of the collaborators will encounter. This slowed down the speed of programming, the lack of concentration.

Reproduced in: https: //www.cnblogs.com/1148510216yong/p/8824540.html

Guess you like

Origin blog.csdn.net/weixin_30808253/article/details/94785835