用API優先和API模擬打破軟件交付關鍵路徑上的依賴

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發團隊通過API模擬打破關鍵路徑依賴,將串行流程變成了並行。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本文將探討在哪些地方使用API模擬可以產生最有效的影響,並提供了一個模型用於估算API模擬和API優先開發模式的回報率。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"轉向API優先開發模式以及API模擬案例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"企業軟件行業正在從單體系統轉向部署在私有云或公有云上的分佈式微服務架構。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這種架構轉變推動了"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.com\/articles\/api-first-integration","title":"","type":null},"content":[{"type":"text","text":"API優先"}]},{"type":"text","text":"開發模式的發展,不同的開發團隊通過API來定義業務契約。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在實現與特定API耦合的特性之前先定義好契約,讓團隊能夠並行開發API的生產者和消費者。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在大多數情況下,爲了有效地實現API優先模式,需要採用API模擬。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"請參見下面的圖1,瞭解API模擬是如何被應用在測試當中的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"關於如何在測試微服務時使用API模擬以及其他"},{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/Test_double","title":"","type":null},"content":[{"type":"text","text":"Test Double"}]},{"type":"text","text":"測試技術,請參見“"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.com\/articles\/twelve-testing-techniques-microservices-intro","title":"","type":null},"content":[{"type":"text","text":"測試微服務:12個有用的技術(第1部分)"}]},{"type":"text","text":"”。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-1-Architectural-overview-of-API-mocks-in-microservice-architectures-1636990820127.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖1:微服務架構中的模擬API"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"API模擬案例學習"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"一家InsurTech初創公司使用Golang和Python開發微服務,並部署在Kubernetes的Docker中。他們使用基於gRPC的API實現微服務之間的通信。一個開發團隊必須等待其他團隊先完成gRPC API才能開始自己的開發工作,導致團隊之間發生時間線堵塞,初創公司無法以客戶需要的節奏交付產品。工程副總裁很清楚,他們需要找到一個解決方案,能夠讓團隊實現獨立開發。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"通過使用模擬gRPC API,他們消除了團隊之間的時間線阻塞。與開源替代方案不同,它提供了複雜的消息模式特性以及最新的協議特性支持。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發團隊使用模擬API並行開發他們的gRPC API,不需要等待服務器端代碼就緒就可以測試客戶端代碼。他們在CI構建代理上運行自動化測試套件,模擬API就運行在代理上的Docker容器中。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"回報率計算模型"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們基於上述的例子創建了一個電子表格,你可以用它計算出採用API模擬所獲得的回報率。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"請單擊"},{"type":"link","attrs":{"href":"https:\/\/docs.google.com\/spreadsheets\/d\/1-VD7zoFGAc09QdnMS5mcNcvYiuznD_qSkar3QlIChyY\/edit?usp=sharing","title":"","type":null},"content":[{"type":"text","text":"鏈接"}]},{"type":"text","text":"下載這個表格。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-2-Before-and-after-using-API-mocks-to-parallelize-teamwork-two-team-example-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖2:兩個團隊使用API模擬之前和之後的對比"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-3-Spreadsheet-to-calculate-the-cost-of-delay-of-not-using-API-mocking-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖3:用模型計算不使用API模擬的成本延遲"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在圖3中,用戶輸入是藍色的,計算結果是黃色的。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"圖3的用戶輸入包括:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"團隊完成功能開發需要做多少工作?"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"團隊因爲等待API就緒被阻塞了多少天?"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"定義API需要多長時間?(通常是2天)"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"熟悉API模擬工具需要多長時間?(通常是4天)"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"創建模擬API需要多長時間?(通常是2天)"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果API發生變化,同步模擬API需要多長時間?"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"真實API就緒之後需要多長時間進行集成?針對這個模型,我們做了一些關鍵性的假設:"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"如果依賴的API不就緒,其他團隊就沒辦法進行並行開發,他們需要真實API或模擬API才能繼續開發工作;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"生產者團隊和消費者團隊都可以定義API(通過Swagger、Proto、WSDL,等等);"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發團隊採用看板開發模式(沒有Sprint或迭代);"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發人員正在編寫自動化測試;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"API模擬由API消費者團隊(而不是API生產者團隊)創建;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"API定義是穩定的,不會發生重大變更。如果發生次要的變更,需要在團隊之間傳達;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"當真實API就緒時,可以立即用它們進行集成測試;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"開發團隊可以使用該電子表格中的其他表格來實現更多的API模擬(例如加快構建速度、處理更多的故障場景,等等),但出於簡單起見,我們不把它們納入到這個模型。如果這些假設與你的開發流程相匹配,我們很願意一起討論一下,併爲你們創建合適的模型。"}]}]}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"在關鍵路徑上使用API模擬"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們已經看到API模擬適用於有兩個開發團隊相互依賴的場景,對於需要多個團隊一起開發新產品或新功能的項目,也同樣適用。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"通過API模擬來並行化開發工作——以簡單的兩個團隊爲例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"團隊A的新功能在發佈到生產環境之前需要依賴團隊B的東西。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"圖2給出了一個描述此種情況的甘特圖。團隊B在開發新功能,他們的API在第20天才能提供,團隊A開發的新功能在第35天就緒,然後開始做集成測試。最後,新功能在第37天部署到生產環境。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"假設這兩個團隊決定採用API優先的開發模式,開始定義團隊之間的業務契約。他們定義系統之間的API,並使用了API模擬,新功能在第26天部署到生產環境。對於這種場景,在團隊B的部分成員已經開始開發新功能的同時,其他成員和團隊A的部分成員在幾天內定義好系統的API。通常,團隊A可以開始培訓如何使用API模擬,並在大概4天的時間裏創建好模擬API。團隊A有了模擬API就可以開發他們的新功能,並在開發完成之後與團隊B集成,這可能比使用真實API要多花一天時間,畢竟模擬API不可能完全精確地模擬真實系統,要與真實API順暢集成,需要做一些細小的改動。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"要想加快速度,還有另一種選項,就是將模擬API外包給第三方供應商。如果模擬API外包出去,那麼新功能就可以在第20天完成。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"因爲採用了API模擬和API優先的開發模式,我們加快了發版速度,可以在第20天發版,而不是第37天。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"通過API模擬來並行化開發工作——以多團隊合作爲例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們對上面的例子做一個擴展,將兩個團隊擴展到四個團隊。在這個例子中,我們有團隊A、B、C和D,它們一起爲公司開發一個複雜的功能。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"團隊A負責開發手機號轉移功能,他們依賴了手機號客戶服務API,該API由團隊B負責。團隊B的API依賴了手機號查詢功能,該功能由團隊C負責。團隊C依賴了團隊D,團隊D負責手機號的第三方服務集成。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"團隊A要等到第70天交付他們負責的部分,但他們感到壓力很大,他們要等到第61天才能開始他們的開發工作,因爲團隊B的功能要在那天才能完成。見圖4。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-4-Four-teams-working-in-sequence-on-delivering-a-big-feature-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖4:四個團隊串行開發,共同完成一個大功能"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在看了項目計劃之後,團隊A決定提早開始開發工作。他們找到團隊B,與他們一起定義API。他們創建了模擬API,在第43天就開始開發,而不是第61天。見圖5。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-5-Teams-A-and-B-work-in-parallel-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖5:團隊A和團隊B並行開發"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這樣團隊A就有了更多的喘息時間,因爲他們在第66天就完成了開發工作,而不是第70天。如果其他團隊出了什麼差錯,他們有更多的糾錯餘地。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在看了更新過的項目計劃之後,團隊B意識到自己是離交付截止日期最近的。他們本來有10天時間(距離第70天),但現在只有6天(距離第66天)。他們決定開始與團隊C並行開發。在與團隊B溝通過後,團隊C意識到他們也可以與團隊D並行開發。這麼看來,這個功能應該可以在第30天交付,而不是第70天。見圖6。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-6-All%20teams-work-in-parallel-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖6:所有團隊都並行開發"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"值得一提的是,如果有必要,各個團隊使用模擬API的順序是可以調換的。例如,如果團隊C率先使用了模擬API並提前幾天交付功能,這樣就可以降低團隊B和團隊A的風險,爲後續API定義的變動騰出了一些緩衝時間。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"由於不可預見的複雜性,計劃的時間越長,里程碑延後的風險就越大——你可以儘早使用API模擬開始開發工作,將里程碑向左移,並儘早識別出關鍵風險。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"儘管這個模型做了一些關鍵性的假設,但它所傳達的要點在於在採用API優先開發模式時如何通過API模擬來並行化團隊的開發工作。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"並行開發的回報率計算"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"正如上面的甘特圖表所示,這個功能現在可以提前40天交付。我們可以在“RESULTS”部分看到這個。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這對那些爲初創公司工作的高管來說很重要,因爲他們已經向股東或投資者承諾某個功能將在指定日期前準備好。這個模型可以降低交付時間方面的風險,並幫他們實現承諾。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這個"},{"type":"link","attrs":{"href":"https:\/\/docs.google.com\/spreadsheets\/d\/1-VD7zoFGAc09QdnMS5mcNcvYiuznD_qSkar3QlIChyY\/edit#gid=0","title":"","type":null},"content":[{"type":"text","text":"電子表格"}]},{"type":"text","text":"計算出了在12個月內沒有采用並行開發所造成的延遲成本。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/imgopt.infoq.com\/fit-in\/1200x2400\/filters:quality(80)\/filters:no_upscale()\/articles\/api-mocking-break-dependencies\/en\/resources\/1Figure-7-The-%20RESULTS-section-in-the-cost-of-delay-spreadsheet-1636991461539.jpg","alt":null,"title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖7:延遲成本電子表格的RESULTS部分"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這也可以估算出延遲在企業中採用API模擬所造成的價值損失。對於圖7所示的情況,我們假設當新功能對客戶可用時,公司每天應該多賺5000美元。我們把40天乘以5000美元,也就是說,如果他們不採用API模擬,公司將損失20萬美元。假設該公司決定每年花1萬美元購買付費解決方案,延遲成本也只下降到19萬美元。在本例中,我們假設公司不只開發這一個功能,相反,在未來12個月內將開發三個功能。在這種情況下,由於沒有采用API模擬和API優先的開發模式來交付這些功能,他們可能會損失59萬美元。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"如何開始採用API模擬"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"採用API優先的開發模式和API模擬可以先從一個團隊開始。讓整個組織都採用這種方法確實是有好處的,但這並不妨礙你先從其中的一個團隊開始,設定一個容易實現的目標。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在選擇第一個採用API優先開發模式和API模擬的團隊時,可以先確定業務關鍵特性,在甘特圖上列出所有涉及的團隊,並選擇在進行並行開發時對項目截止日期影響最大的那個團隊。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"或者,如果你是團隊負責人,面臨着交付截止日期的壓力,就像上述例子中的團隊A,你可以主動讓團隊採用API優先的開發模式和API模擬,以此來減輕團隊正在承受的壓力。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"這個"},{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_API_simulation_tools","title":"","type":null},"content":[{"type":"text","text":"Wiki頁"}]},{"type":"text","text":"提供了一個對團隊十分有用的API模擬工具清單。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"作者簡介:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/www.linkedin.com\/in\/wojciechbulaty","title":"","type":null},"content":[{"type":"text","text":"Wojciech Bulaty"}]},{"type":"text","text":"專攻企業軟件開發和測試架構。他在寫作中融入了十多年的親身編程和領導經驗。他現在是Traffic Parrot團隊的一員,通過提供API模擬和服務虛擬化工具幫助微服務開發團隊加速交付、提高質量並縮短髮布時間。你可以在"},{"type":"link","attrs":{"href":"https:\/\/twitter.com\/WojciechBulaty","title":"","type":null},"content":[{"type":"text","text":"推特"}]},{"type":"text","text":"上關注Wojciech,也可以在"},{"type":"link","attrs":{"href":"https:\/\/www.linkedin.com\/in\/wojciechbulaty","title":"","type":null},"content":[{"type":"text","text":"LinkedIn"}]},{"type":"text","text":"上聯繫他。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"原文鏈接"},{"type":"text","text":":"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/www.infoq.com\/articles\/api-mocking-break-dependencies","title":"","type":null},"content":[{"type":"text","text":"Using API-First Development and API Mocking to Break Critical Path Dependencies"}]}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章