混乱的代码是技术债吗
Posted ljheee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了混乱的代码是技术债吗相关的知识,希望对你有一定的参考价值。
翻译自 Uncle Bob
的 Blog A Mess is not a Technical Debt
主要是鲍勃大叔的观点:混乱的代码实现不是技术债。原文地址见超链接。
The term Technical Debt was created by Ward Cunningham to describe the engineering trade-off’s that software developers and business stakeholders must often make in order to meet schedules and customer expectations. In short, you may need to use suboptimal designs in the short term, because the schedule does not allow longer term designs to be used. As a simple example, your initial website design may need to be frames based because you don’t have time to build an Ajax framework.
技术债务一词由 Ward Cunningham 提出,用于描述软件开发人员和业务利益相关者必须经常做出的工程权衡,以满足交付进度和客户期望。 简而言之,可能需要在短期内使用次优设计,因为时间表不允许使用长期设计。 举个简单的例子,您的初始网站设计可能需要基于框架(frames based),因为您没有时间构建 Ajax 框架。
Clearly this causes a debt. If the customer is looking for a web 2.0 system, then frames just aren’t going to cut it for long. So time is going to have to be carved out of a future schedule to refit the system with an Ajax solution.
显然,这会导致债务。如果客户正在寻找一个 web 2.0 系统,那么框架就不会长期削减它。因此,必须从未来的计划中抽出时间来用 Ajax 解决方案改造系统。
In short, the business has decided that it can afford to delay release 2 in order to accelerate release 1. Is this wise?
简而言之,企业已经决定延迟发布版本 2 以加速发布版本 1。这是明智的吗?
Businesses make this kind of trade-off all the time; and there’s nothing inherently unwise about it. If the early release of 1.0 drives the business that pays for the development of 2.0 then the business has won. So this kind of reasoned technical debt may indeed be appropriate.
企业一直在进行这种权衡;它本身并没有什么不明智的。如果 1.0 的早期发布推动了为 2.0 的开发买单的企业,那么企业就赢了。所以这种合理的技术债可能确实是合适的。
Unfortunately there is another situation that is sometimes called “technical debt” but that is neither reasoned nor wise. A mess.
不幸的是,还有另一种情况有时被称为“技术债”,但这既不合理也不明智。一一一团混乱的代码。
Technical debt may be necessary, but it had also better be clean! If you are going to implement a frames solution instead of an AJAX solution, then make sure that the workmanship of the frames solution is top-notch. Make sure the design is well balanced, and the code is clean. If you make a mess while implementing that frames solution, you’ll never be able to replace it with an AJAX framework. The mess will impede your progress forever.
技术债务可能是必要的,但它也最好是整洁的!如果您要实现框架解决方案而不是AJAX 解决方案,那么请确保框架解决方案的工艺是一流的。确保设计平衡良好,代码整洁。如果您在实现该框架解决方案时弄得一团糟,您将永远无法用AJAX框架替换它。混乱将永远阻碍你的进步。
A mess is not a technical debt. A mess is just a mess. Technical debt decisions are made based on real project constraints. They are risky, but they can be beneficial. The decision to make a mess is never rational, is always based on laziness and unprofessionalism, and has no chance of paying of in the future. A mess is always a loss.
混乱的代码实现不是技术债。混乱的实现只是一团糟糕的代码。技术债务决策是根据实际项目限制做出的。它们是有风险的,但它们可能是(对项目)有益的。让编码混乱的行为永远是不理智的,它永远都是因为(开发者)懒惰和不专业造成的,而且将来你也永远还不清这种债务。混乱永远都是一种错误……
When you buy a house and take on a big mortgage debt, you tighten up all your spending and accounting. You clean up your books and your budgets. You behave with increased discipline. The same is true of technical debt. The more technical debt you take on, the tighter your disciplines need to be. You should do more testing, and more pairing and more refactoring. Technical debt is not a license to make a mess. Technical debt creates the need for even greater cleanliness.
当您购买房屋并承担巨额抵押贷款时,您会收紧所有支出和账户消费。你清理你的订单和你的预算,你表现得更加自律。技术债务也是如此。你承担的技术债务越多,你收紧得就应该越严格。你应该做更多的测试,更多的结对编程和更多的重构。技术债务不是制造混乱的许可证。技术债务创造了对更高整洁度的需求。
When you decide to take on a technical debt, you had better make sure that your code stays squeaky clean. Keeping the system clean is the only way you will pay down that debt.
当您决定承担技术债务时,您最好确保您的代码保持干净整洁。保持系统清洁是偿还债务的唯一方法。
以上是关于混乱的代码是技术债吗的主要内容,如果未能解决你的问题,请参考以下文章