代码大全学习-24-合作开发(Collaborative Construction)

这一章介绍了合作开发的一些常用方法。所有的合作开发都基于这样一个前提,即任何开发人员都有自己的盲点,大家的盲点不一样,所以合作起来就可以减少盲点,也就减少了开发缺陷出现的几率。合作开发的方法有很多,结对编程,正式审查(Formal Inspections),非正式审阅,读代码,读文档,几个人讨论等等,形式多样,不必拘泥。作者在书中重点讲了前面两种。

结对编程相信大家就算没用过也至少有所耳闻。方法很简单,两个人一组,一个写代码,一个在旁边看。看不是简单的看看就完了,要主动分析代码有没有写错,功能是否正确,是不是我们想要的代码,设计对不对,接下来要写什么,怎么测试等等。两个人可以轮流着写和看。这种方法可以提高代码的质量,因为写的时候有人看,会尽量写好,出错了也会有人及时指出。所以总体来说会减少缺陷出现的几率,从而提高效率。当然凡事没有绝对,也不是所有的情形都要用结对编程,有些很简单或者很复杂的情况可以考虑其他的方法。这里附上一个checklist可以在运用这种方法的时候参考。

Checklist: Effective Pair Programming

  • Do you have a coding standard to support pair programming that's focused on programming rather than on philosophical coding-style discussions?
  • Are both partners participating actively?
  • Are you avoiding pair programming everything, instead selecting the assignments that will really benefit from pair programming?
  • Are you rotating pair assignments and work assignments regularly?
  • Are the pairs well matched in terms of pace and personality?
  • Is there a team leader to act as the focal point for management and other people outside the project?

正式审查在发现缺陷上是比测试更经济的一种方法,在IBM使用多年,后来公开出来。其目的主要是发现缺陷,而不是改正缺陷。它是由开发人员来做的,而不是测试人员。其步骤比较多,大体上有计划准备,开审查会议,出审查报告,后期追踪几个部分。过程中会把参与的人赋予各个角色,协调员,作者,审查人,记录人等。需要注意的一点是这应该是一个纯技术的探讨,不要把老板扯进来,也不要根据审查结果来算绩效。具体方法还是参考原书吧,这里附上一个checklist供参考。

Checklist: Effective Inspections

  • Do you have checklists that focus reviewer attention on areas that have been problems in the past?
  • Is the emphasis on defect detection rather than correction?
  • Are inspectors given enough time to prepare before the inspection meeting, and is each one prepared?
  • Does each participant have a distinct role to play?
  • Does the meeting move at a productive rate?
  • Is the meeting limited to two hours?
  • Has the moderator received specific training in conducting inspections?
  • Is data about error types collected at each inspection so that you can tailor future checklists to your organization?
  • Is data about preparation and inspection rates collected so that you can optimize future preparation and inspections?
  • Are the action items assigned at each inspection followed up, either personally by the moderator or with a re-inspection?
  • Does management understand that it should not attend inspection meetings?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值