Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
您可以通过某种经济方式或程序员的方式来实现。
如果采用经济的方式,您可以衡量改进代码、修复错误、添加新功能等的成本。 如果您选择第二种方式,您可能需要衡量有多少员工使用您的程序,以及在人工时间内查找和修复平均错误的容易程度。 当然它们也不是完美无缺的,因为成本取决于市场情况,工时取决于实际人员及其技能,所以最好将两种方法结合起来。
通过这种方式,您可以获得一些工具来衡量代码的质量。 当然,您应该考虑项目的规模和其他因素,但我希望主要思想是明确的。
You could do it in some economic way or in programmer's way.
In case of economic way you mesaure costs of improving code, fixing bugs, adding new features and so on. If you choose the second way, you may want to measure how much staff works with your program and how easy it is to, say, find and fix an average bug in human hours. Certainly they are not flawless, because costs depend on the market situation and human hours depend on the actual people and their skills, so it's better to combine both methods.
This way you get some instruments to mesaure quality of your code. Of course you should take into account the size of your project and other factors, but I hope main idea is clear.
一个更以客户为中心的指标是软件供应商修复错误和实现新功能所需的平均时间。
根据错误跟踪软件的创建日期和关闭信息,计算起来非常容易。
如果您的平均错误修复/功能实现时间非常长,这也可能表明软件质量较差。
A more customer focused metric would be the average time it takes for the software vendor to fix bugs and implement new features.
It is very easy to calculate, based on your bug tracking software's date created, and closed information.
If your average bug fixing/feature implementation time is extremely high, this could also be an indicator for bad software quality.
您可能需要检查以下页面< /a> 描述软件质量的各个不同方面,包括示例图。 您需要测量的一些质量特性可以使用声纳等工具得出。 弄清楚您希望如何对以下一些方面进行建模非常重要:
You may want to check the following page describing various different aspects of software quality including sample plots. Some of the quality characteristics you require to measure can be derived using tool such as Sonar. It is very important to figure out how would you want to model some of the following aspects:
如果按照您所说的方式衡量代码质量,这将是一项非常简单的工作,而且指标也很准确,那么可能就不再需要项目经理了。 更重要的是,优秀管理者和糟糕管理者之间的区别非常小。 因为事实并非如此,这只是表明准确了解软件的质量并不是一件容易的事。
您的问题涉及多个领域,这些领域的量化方式不同,或者量化非常主观,因此您应该将这些问题分为与共同目标相对应的类别。 然后,您可以为每个类别分配一个“重要性”因素,并从中得出一些指标。
例如,您可以使用静态代码分析工具< /a> 用于测量代码的语法质量并从中得出一些指标。
您还可以使用与版本控制系统集成的错误跟踪工具从错误/代码行中获取指标。
为了衡量编码过程的稳健性、重用性和效率,您可以评估每个开发功能的设计模式的使用情况(当然在有意义的情况下)。 没有任何工具可以帮助您实现这一目标,但如果您监控软件的规模不断扩大并对其进行统计,它可以让您很好地了解项目的发展情况以及项目是否朝着正确的方向发展。 引入代码审查程序可以帮助您更轻松地跟踪这些问题,并可能在开发过程的早期解决它们。 这些数字可能是使用适当的设计模式实现的功能的百分比。
虽然指标可能非常抽象和主观,但如果您投入时间并始终尝试改进它们,它可以为您提供有用的信息。
不过,关于软件流程中的指标,需要注意以下几点:
If measuring code quality in the terms you put it would be such a straightforward job and the metrics accurate, there would probably be no need for Project Managers anymore. Even more, the distinction between good and poor managers would be very small. Because it isn't, that just shows that getting an accurate idea about the quality of your software, is no easy job.
Your questions span to multiple areas that are quantified differently or are very subjective to quantification, so you should group these into categories that correspond to common targets. Then you can assign an "importance" factor to each category and derive some metrics from that.
For instance you could use static code analysis tools for measuring the syntactic quality of your code and derive some metrics from that.
You could also derive metrics from bugs/lines of code using a bug tracking tool integrated with a version control system.
For measuring robustness, reuse and efficiency of the coding process you could evaluate the use of design patterns per feature developed (of course where it makes sense). There's no tool that will help you achieve this, but if you monitor your software growing bigger and put numbers on these it can give you a pretty good idea of how you project is evolving and if it's going in the right direction. Introducing code-review procedures could help you keep track of these easier and possibly address them early in the development process. A number to put on these could be the percentage of features implemented using the appropriate design patterns.
While metrics can be quite abstract and subjective, if you dedicate time to it and always try to improve them, it can give you useful information.
A few things to note about metrics in the software process though:
如果您使用 Ruby,有一些工具可以帮助您处理 LOC/方法 和方法/类 Saikuros 圈复杂度等指标。
我的老板实际上在去年的 ruby 会议上就我们使用的软件指标进行了演示,这些是幻灯片。
metric_fu 是一个有趣的工具,它可以同时为您提供大量指标。 它检查代码的许多有趣的方面。 高度相似、变化很大、有很多分支的东西。 所有迹象都表明您的代码可能会更好:)
我想对于其他语言也有更多类似的工具。
If you are using Ruby, there are some tools to help you out with metrics ranging from LOCs/Method and Methods/Class Saikuros Cyclomatic complexity.
My boss actually held a presentation on software metric we use at a ruby conference last year, these are the slides.
A interesting tool that brings you a lot of metrics at once is metric_fu. It checks alot of interesting aspects of your code. Stuff that is highly similar, changes a lot, has a lot of branches. All signs your codes could be better :)
I imagine there are lot more tools like this for other languages too.
软件讨论组中的老 Joel 有一个很好的 线程这。
There is a good thread from the old Joel on Software Discussion groups about this.
我知道一些 SVN stat 程序提供了每次提交的更改行的概述。 如果您有一个错误跟踪系统,并且修复错误、添加功能等的人员在修复错误时说明了他们的提交编号,那么您可以计算出每个错误/新功能请求影响了多少行。 这可以为您提供可变性的衡量标准。
接下来的事情就是简单地计算发现的错误数量,并将它们设置为与代码行数的比率。 高质量软件每个代码线应该有多少个错误有一些值。
I know that some SVN stat programs provide an overview over changed lines per submit. If you have a bugtracking system and persons fixing bugs adding features etc are stating their commit number when the bug is fixed you can then calculate how many line were affected by each bug/new feature request. This could give you a measurement of changeability.
The next thing is simply count the number of bugs found and set them in ratio to the number of code lines. There are some values how many bugs a high quality software should have per codeline.