Act with Prudence谨慎行动(97 Things Every Programmer Should Know 1/97)

编程入门 行业动态 更新时间:2024-10-11 11:19:10

Act with Prudence<a href=https://www.elefans.com/category/jswz/34/1768244.html style=谨慎行动(97 Things Every Programmer Should Know 1/97)"/>

Act with Prudence谨慎行动(97 Things Every Programmer Should Know 1/97)

文章链接:Act with Prudence(谨慎行动)

原文

Whatever you undertake, act with prudence(谨慎) and consider the consequences" Anon

No matter how comfortable a schedule looks at the beginning of an iteration, you can’t avoid being under pressure some of the time. If you find yourself having to choose between “doing it right” and “doing it quick” it is often appealing(对...有吸引力)to “do it quick” on the understanding that you’ll come back and fix it later. When you make this promise to yourself, your team, and your customer, you mean it. But all too often (经常是)the next iteration brings new problems and you become focused on them. This sort of deferred(推迟) work is known as technical debt(技术债) and it is not your friend. Specifically, Martin Fowler calls this deliberate(故意的) technical debt in his taxonomy (分类) of technical debt, which should not be confused with inadvertent(无意的) technical debt.

Technical debt is like a loan: You benefit from it in the short-term, but you have to pay interest(利息)on it until it is fully paid off. Shortcuts in the code make it harder to add features or refactor your code. They are breeding grounds for defects and brittle test cases. The longer you leave it, the worse it gets. By the time you get around to(抽时间做) undertaking(承担,保证) the original fix there may be a whole stack(一大堆) of not-quite-right(不太正确) design choices layered on top of the original problem making the code much harder to refactor and correct. In fact, it is often only when things have got so bad that you must fix it, that you actually do go back to fix it. And by then(到那个时候) it is often so hard to fix that you really can’t afford the time or the risk.

There are times when(有时候) you must incur(招致,带来) technical debt to meet(满足) a deadline or implement a thin slice of (一薄片)a feature. Try not to be in this position, but if the situation absolutely demands it, then go ahead. But (and this is a big BUT) you must track(追踪,留下足迹) technical debt and pay it back quickly or things go rapidly downhill(下坡). As soon as you make the decision to compromise, write a task card or log it in your issue(问题,发行物) tracking system to ensure that it does not get forgotten.

If you schedule repayment(偿还) of the debt in the next iteration, the cost will be minimal. Leaving the debt unpaid will accrue(产生,获得) interest and that interest should be tracked to make the cost visible. This will emphasize the effect on business value of the project’s technical debt and enables(使能够,使成为可能) appropriate prioritization(优先次序) of the repayment. The choice of how to calculate and track the interest will depend on the particular project, but track it you must.

Pay off technical debt as soon as possible. It would be imprudent(轻率的,不谨慎的) to do otherwise.

By Seb Rose


翻译:

无论你遭遇什么,谨慎行动,并考虑后果.–Anon.

在一次迭代开始的时候,无论工作计划看起来多么舒服,你都不可避免的在一些时候遭受压力.如果你发现自己必须在"正确地做完"和"尽快做完"之间进行选择的时候,你经常会选择"尽快做完",并且明白你将很快回来并去修复它.当你向自己,你的团队和你的客户承诺时,你就意味着是这样的情况.但是经常是下次迭代带来新的问题,并且你需要关它们.这类被推迟的工作被称为技术债,而且它不是你的朋友.特别地,Martin Fowler在<技术债的分类中>称不应该将这种故意的技术债和无意的技术债混淆.

技术债就像贷款:你短期从中获益,但是你必须在完全付清之前支付利息.在代码中走捷径让你添加特性和重构代码变得困难.它们是瑕疵和脆弱的测试用例的滋生地.你离开的越久,它就会变得越坏.在你抽时间承担最初的修复工作之前,会有一大堆不太正确的设计选择叠放在原始问题之上,让代码更难以去重构和修改.实际上,只有当事情变得真正糟糕你必须去修复它的时候,你才返回去修复它.但到那个时候,事情会变的很难修复以至于你不能负担起时间和风险.

有时候你为了去满足截止日期或者实现一些特征,一定会带来一些技术债.尽量去避免处于那个位置,如果情况要求一定要去做的话,那就先那样做吧.但是(这是一个大写的"但是")你必须追踪技术债,并且尽快还上它,否则事情会很快走下坡路.一旦你决定去做妥协的时候,你就要写一个任务卡或者把它记录到你的问题追踪系统中,确保这件事情不会被忘记.

如果你计划在下一个迭代中去偿还技术债的话,这个花费是最小的.留下债务不去偿还会产生利息,这个利息需要被追踪以使得花费可以被看到.需要强调项目技术债商业价值的影响,并且能出适当的偿还的优先次序.如何去计算和追踪利息的选择取决于特定的项目,但你必须去追踪它.

尽可能地去还清技术债,否则它将成为轻率的事情.
–Seb Rose

更多推荐

Act with Prudence谨慎行动(97 Things Every Programmer Should Know 1/97)

本文发布于:2024-03-06 16:10:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1715764.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:谨慎   Prudence   Act   Programmer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!