通过估计一年内编写的代码来计算可以节省多少时间

发布于 2024-08-18 21:58:33 字数 1431 浏览 10 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笨笨の傻瓜 2024-08-25 21:58:33

平均每天 18000 行代码约为 36 行。

一天才36行代码,有什么问题吗?问题是调试和重写你的代码。

任何你能做的自动化编码都不会加快你的速度——事实上,任何你可以自动化的东西可能都不应该被编码,因为如果你在代码中自动输入某些模式,它应该被排除在外。

可以节省时间的地方是更加小心地编写代码。让您的项目更快地通过 QA——使用更明确、类型安全的语言进行编码,并且代码更清晰。

此外,尽可能让您的代码数据驱动并完全分解,虽然它会减少您交付的 LOC,但它将使每个人的生活更轻松,项目交付更快。

永远不要自动执行代码输入——如果可以的话,那你就错了!

另一种思考方式——您创建的每一行代码都必须进行调试和维护。当您可以创建完全分解的代码时,为什么要尝试想出方法来给每个人更多的工作(完全分解的代码的输入不能自动化——几乎根据定义)。

18000 would average out to about 36 lines of code a day.

With just 36 lines of code a day, what's the problem? The problem is debugging and rewriting your code.

NOTHING you can do to automate coding will speed you up--in fact, anything you can automate probably shouldn't be coded because if you are automating the typing of some pattern in your code, it should be factored out.

Where you can save time is to be more careful about how you code. Get your project through QA a little faster--code in a more explicit, typesafe language and code more clearly.

Also making your code data driven and fully factored wherever possible, although it will reduce the LOC you ship, it will make everyone's life easier and the project ship faster.

Do not EVER automate code input--if you can, you're doing it wrong!

Another way to think about it--every line of code you create has to be debugged and maintained. Why are you trying to come up with ways to give everyone MORE work when you could just create fully factored code (The input of fully factored code cannot be automated--pretty much by definition).

挽心 2024-08-25 21:58:33

首先,编写的代码行数与实际生产力并没有很好的相关性。至少在我看来,如果你想衡量和/或估计生产力,功能点是更有效的衡量标准。其次,当一个指标在很大范围内变化时,平均值通常意义不大。在这种情况下,几何平均值通常比算术平均值更有意义,但如果(至少)没有方差/标准差,它仍然没有多大意义。

我还要指出的是,有一些相当复杂的模型经过了大量研究,甚至针对真实项目进行了测量,以至少了解它们的结果与现实相关。例如,COCOMO II 模型通常会产生比仅使用每单位时间的代码行数。至少有一个免费在线实现(编辑:看看它,现在允许LoC 或基于功能点的建模)。还有一些工具,例如 SoftStar功能点建模器)将类似 COCOMO 的模型与功能点相结合,以获得看起来(至少对我来说)相当可靠的东西结果。

First, lines of code written don't correlate well with actual productivity. At least in my opinion, if you want to measure and/or estimate productivity, function points are a more effective measurement. Second, when a metric varies over a wide range, the average generally means very little. In a case like this, a geometric mean generally means more than an arithmetic mean, but without (at least) something about the variance/standard deviation, it still doesn't mean much.

I'd also note that there are some fairly sophisticated models that have undergone substantial research and even measured against real projects to get at least some idea that their results correlate with reality. For example, the COCOMO II model will generally produce much better results than just using lines of code per unit of time. There's at least one free online implementation (Edit: looking at it, this now allows either LoC or function point based modeling). There are also a tools such as SoftStar and Function Point Modeler) that combine a COCOMO-like model with function points to get what appear (at least to me) to be fairly solid results.

撞了怀 2024-08-25 21:58:33

这是神话人月中讨论的指标类型。以人日/月/年为单位估算项目,或将代码行数作为生产力指标进行计算,会导致报告不准确。

This is the type of metric talked about in the Mythical Man Month. Estimating projects in Man-Days/Months/Years, or counting lines of code as a productivity metirc guarantees inaccuracy in reporting.

小兔几 2024-08-25 21:58:33

我认为 LOC 的费率很大程度上取决于项目中的技术债务

我有一个项目(SQL)是 27KLOC(加上 4K 的支持)。我在这个代码上工作了 7 个多月,向项目添加了 3K 净新 LOC,其中大约 14KLOC 是为了一次性测试(隔离异常的测试,而不是单元测试)而编写的。

根据你的衡量方式,我写了 29KLOC/年 ((3K+14K)/7 个月*12 个月),但只产生 5KLOC/年 (3K/7 个月*12 个月)。

将代码 (27KLOC) 视为债务,我们的代码每月可生成 7% (2KLOC) 的一次性代码,或每年生成 88% (24KLOC)。

假设我可以继续产出 29KLOC/年,并且假设维护代码的成本保持在 88%/年,我个人的项目限制是 33K 行代码。除此之外,我将把所有的时间都花在支付技术债务利息、编写一次性代码和生成净零 LOC 上。

幸运的是,最后 3KLOC 是一次重构,这应该会降低我的利率。

I believe the rate for LOC highly depends on the technical debt in the project.

I have a project (SQL) which is 27KLOC (plus 4K more for support). Working on this code, over 7 months, I added 3K net new LOC to the project, with about 14KLOC written just for throwaway testing (testing to isolate anomalies, not unit tests).

Depending on how you measure, I write 29KLOC/year ((3K+14K)/7months*12months) but produce only 5KLOC/year (3K/7months*12months).

Looking at code (27KLOC) as debt, we have code that generates 7% (2KLOC) in throwaway code monthly, or 88% (24KLOC) per annum.

Assuming I can continue to turn out a whole 29KLOC/year, and assuming the cost of maintaining code stays at 88%/annum, my personal project limit is 33K lines of code. Beyond which, I will spend all my time paying interest on my technical debt, writing throwaway code, and producing net zero LOC.

Lucky that the last 3KLOC was a refactoring, which should reduce my interest rate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文