您将如何衡量代码的“质量"?在一个大型项目中 [英] How would you measure code "quality" across a large project

查看:198
本文介绍了您将如何衡量代码的“质量"?在一个大型项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个相当大的公司中从事一个大型项目,正在开发中,这需要几年的时间,而且我正在承担提高总体代码质量的任务.

I'm working on a quite large project, a few years in the making, at a pretty large company, and I'm taking on the task of driving toward better overall code quality.

我想知道在这种情况下您将使用哪种度量标准来度量质量和复杂性.我不是在寻找绝对的措施,而是一系列可以随着时间而改进的项目.鉴于这是跨数百个项目的宏观操作(我已经看到一些有关较小项目的问题),所以我正在寻找更自动化和整体化的东西.

I was wondering what kind of metrics you would use to measure quality and complexity in this context. I'm not looking for absolute measures, but a series of items which could be improved over time. Given that this is a bit of a macro-operation across hundreds of projects (I've seen some questions asked about much smaller projects), I'm looking for something more automatable and holistic.

到目前为止,我有一个看起来像这样的列表:

So far, I have a list that looks like this:

  • 全功能测试期间的代码覆盖率
  • BVT故障再次发生
  • 依赖关系图/分数,基于某些工具,例如nDepend
  • 构建警告数量
  • 发现/抑制的FxCop/StyleCop警告数量
  • 捕获"语句的数量
  • 手动部署步骤的数量
  • 项目数量
  • 死"的代码/项目的百分比,如未在任何地方引用
  • 代码审查期间的WTF数量
  • 总代码行,可能按层细分
  • Code coverage percentage during full-functional tests
  • Recurrance of BVT failures
  • Dependency graph/score, based on some tool like nDepend
  • Number of build warnings
  • Number of FxCop/StyleCop warnings found/supressed
  • Number of "catch" statements
  • Number of manual deployment steps
  • Number of projects
  • Percentage of code/projects that's "dead", as in, not referenced anywhere
  • Number of WTF's during code reviews
  • Total lines of code, maybe broken down by tier

推荐答案

您应该围绕六个主要软件质量特征来组织工作:功能,可靠性,可用性,效率,可维护性和可移植性.我已经在图表在线中描述了这些特征.然后,为每个特征确定您想要并能够跟踪的最重要的指标.例如,一些度量标准(例如Chidamber和Kemerer的度量标准)适合于面向对象的软件,而另一些度量标准(例如,圈复杂度)则更通用.

You should organize your work around the six major software quality characteristics: functionality, reliability, usability, efficiency, maintainability, and portability. I've put a diagram online that describes these characteristics. Then, for each characteristic decide the most important metrics you want and are able to track. For example, some metrics, like those of Chidamber and Kemerer are suitable for object-oriented software, others, like cyclomatic complexity are more general-purpose.

这篇关于您将如何衡量代码的“质量"?在一个大型项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆