翻譯自 Uncle Bob
的 Blog A Mess is not a Technical Debt
主要是鮑勃大叔的觀點(diǎn):混亂的代碼實(shí)現(xiàn)不是技術(shù)債蛹头。原文地址見(jiàn)超鏈接顿肺。
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.
技術(shù)債務(wù)一詞由 Ward Cunningham 提出,用于描述軟件開(kāi)發(fā)人員和業(yè)務(wù)利益相關(guān)者必須經(jīng)常做出的工程權(quán)衡渣蜗,以滿(mǎn)足交付進(jìn)度和客戶(hù)期望屠尊。 簡(jiǎn)而言之,可能需要在短期內(nèi)使用次優(yōu)設(shè)計(jì)耕拷,因?yàn)闀r(shí)間表不允許使用長(zhǎng)期設(shè)計(jì)知染。 舉個(gè)簡(jiǎn)單的例子,您的初始網(wǎng)站設(shè)計(jì)可能需要基于框架(frames based)斑胜,因?yàn)槟鷽](méi)有時(shí)間構(gòu)建 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.
顯然嫌吠,這會(huì)導(dǎo)致債務(wù)止潘。如果客戶(hù)正在尋找一個(gè) web 2.0 系統(tǒng),那么框架就不會(huì)長(zhǎng)期削減它辫诅。因此凭戴,必須從未來(lái)的計(jì)劃中抽出時(shí)間來(lái)用 Ajax 解決方案改造系統(tǒng)。
In short, the business has decided that it can afford to delay release 2 in order to accelerate release 1. Is this wise?
簡(jiǎn)而言之炕矮,企業(yè)已經(jīng)決定延遲發(fā)布版本 2 以加速發(fā)布版本 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.
企業(yè)一直在進(jìn)行這種權(quán)衡肤视;它本身并沒(méi)有什么不明智的档痪。如果 1.0 的早期發(fā)布推動(dòng)了為 2.0 的開(kāi)發(fā)買(mǎi)單的企業(yè),那么企業(yè)就贏了邢滑。所以這種合理的技術(shù)債可能確實(shí)是合適的腐螟。
Unfortunately there is another situation that is sometimes called “technical debt” but that is neither reasoned nor wise. A mess.
不幸的是,還有另一種情況有時(shí)被稱(chēng)為“技術(shù)債”困后,但這既不合理也不明智乐纸。一一一團(tuán)混亂的代碼。
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.
技術(shù)債務(wù)可能是必要的摇予,但它也最好是整潔的汽绢!如果您要實(shí)現(xiàn)框架解決方案而不是AJAX 解決方案,那么請(qǐng)確辈啻鳎框架解決方案的工藝是一流的宁昭。確保設(shè)計(jì)平衡良好跌宛,代碼整潔。如果您在實(shí)現(xiàn)該框架解決方案時(shí)弄得一團(tuán)糟久窟,您將永遠(yuǎn)無(wú)法用AJAX框架替換它秩冈。混亂將永遠(yuǎn)阻礙你的進(jìn)步斥扛。
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.
混亂的代碼實(shí)現(xiàn)不是技術(shù)債入问。混亂的實(shí)現(xiàn)只是一團(tuán)糟糕的代碼稀颁。技術(shù)債務(wù)決策是根據(jù)實(shí)際項(xiàng)目限制做出的芬失。它們是有風(fēng)險(xiǎn)的,但它們可能是(對(duì)項(xiàng)目)有益的匾灶。讓編碼混亂的行為永遠(yuǎn)是不理智的棱烂,它永遠(yuǎn)都是因?yàn)?開(kāi)發(fā)者)懶惰和不專(zhuān)業(yè)造成的,而且將來(lái)你也永遠(yuǎn)還不清這種債務(wù)阶女〖彰樱混亂永遠(yuǎn)都是一種錯(cuò)誤……
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.
當(dāng)您購(gòu)買(mǎi)房屋并承擔(dān)巨額抵押貸款時(shí),您會(huì)收緊所有支出和賬戶(hù)消費(fèi)秃踩。你清理你的訂單和你的預(yù)算衬鱼,你表現(xiàn)得更加自律。技術(shù)債務(wù)也是如此憔杨。你承擔(dān)的技術(shù)債務(wù)越多鸟赫,你收緊得就應(yīng)該越嚴(yán)格。你應(yīng)該做更多的測(cè)試消别,更多的結(jié)對(duì)編程和更多的重構(gòu)抛蚤。技術(shù)債務(wù)不是制造混亂的許可證。技術(shù)債務(wù)創(chuàng)造了對(duì)更高整潔度的需求寻狂。
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.
當(dāng)您決定承擔(dān)技術(shù)債務(wù)時(shí)岁经,您最好確保您的代碼保持干凈整潔。保持系統(tǒng)清潔是償還債務(wù)的唯一方法蛇券。
本文首發(fā)于公眾號(hào) 架構(gòu)道與術(shù)(ToBeArchitecturer)蒿偎,歡迎關(guān)注、學(xué)習(xí)更多干貨~