javaweb解决编码问题_停止尝试编码解决问题的方法
javaweb解決編碼問(wèn)題
抽象 (Abstract)
Here’s the situation. I need to build a test harness to verify that when my software sends / receives data to some other system (a system outside my control), the data is not only received, but is in fact the data I expected to have been sent.
這是情況。 我需要構(gòu)建一個(gè)測(cè)試工具,以驗(yàn)證當(dāng)我的軟件向其他系統(tǒng)(我無(wú)法控制的系統(tǒng))發(fā)送/接收數(shù)據(jù)時(shí),不僅收到了數(shù)據(jù),而且實(shí)際上是我希望發(fā)送的數(shù)據(jù)。
Pretty standard test harness stuff, right? The testers say they need this for manual and for automation testing suites. Internal customer need. Great.
漂亮的標(biāo)準(zhǔn)測(cè)試裝備,對(duì)吧? 測(cè)試人員說(shuō),他們需要手動(dòng)和自動(dòng)化測(cè)試套件。 內(nèi)部客戶需求。 大。
So the developer starts rattling off software tools / languages we will use to build this test harness.
因此,開(kāi)發(fā)人員開(kāi)始研究將用于構(gòu)建此測(cè)試工具的軟件工具/語(yǔ)言。
Wait, what?
等一下
不太快,牛仔 (Not so fast, cowpoke)
How did we get from a high level need to implementation that fast? Where are our requirements? Where are our user stories? Where the heck are even some simple sequence / flow diagrams to describe whussup?
我們?nèi)绾螐母邔哟蔚男枨罂焖賹?shí)現(xiàn)呢? 我們的要求在哪里? 我們的用戶故事在哪里? 到底哪里有一些簡(jiǎn)單的序列/流程圖來(lái)描述whossup?
Well, the dev imagines he/she has these already in their head, so time to get to the fun stuff, the cutting code stuff, the implementation.
好吧,開(kāi)發(fā)人員認(rèn)為他/她已經(jīng)掌握了這些知識(shí),因此有時(shí)間去學(xué)習(xí)有趣的東西,剪切代碼的東西和實(shí)現(xiàn)。
Sound familiar?
聽(tīng)起來(lái)有點(diǎn)熟?
If so, then do everyone on the team a solid and pull the brakes before the conversation carries on down this line any further.
如果是這樣,那么在對(duì)話繼續(xù)進(jìn)行下去之前,請(qǐng)團(tuán)隊(duì)中的每個(gè)人都站穩(wěn)腳跟并剎車。
We’ve skipped a step, and it happens way more often than we might be willing to admit.
我們已經(jīng)跳過(guò)了一步,而且發(fā)生的頻率比我們可能愿意承認(rèn)的要高。
兩次測(cè)量,切一次 (Measure Twice, Cut Once)
Before I can build anything, I need to understand as best I can what I’m building in order to get to work. I’m not just talking software. You want to build a birdcage, a deck, patio furniture? Any and all of these things (including software) require you to have a clear picture of the item being built, and from this picture you can set off to build it right the first time.
在構(gòu)建任何東西之前,我需要盡可能地了解自己正在構(gòu)建的東西才能開(kāi)始工作。 我不僅在談?wù)撥浖?您要建造鳥(niǎo)籠,甲板,露臺(tái)家具嗎? 所有這些東西(包括軟件)都需要您清楚地了解正在建造的物品,并且可以從這張照片中出發(fā),在第一時(shí)間立即進(jìn)行建造。
Measure twice, cut once is the old adage. That is, before you do any work, make sure you’ve double-checked your measurements before you do anything. The more which you understand what you’re building, the better the chances you will be successful in building it.
測(cè)量?jī)纱?#xff0c;切一次是古老的格言。 也就是說(shuō),在執(zhí)行任何工作之前,請(qǐng)確保在執(zhí)行任何操作之前已仔細(xì)檢查了測(cè)量結(jié)果。 您對(duì)構(gòu)建的內(nèi)容了解得越多,成功構(gòu)建它的機(jī)會(huì)就越大。
And in most industries this still holds true: I won’t buy a car or a house that wasn’t modeled off a blueprint. I don’t buy a mobile phone which someone just slapped together without specs or detailed instructions on how to manufacture it.
在大多數(shù)行業(yè)中,這仍然成立:我不會(huì)買沒(méi)有藍(lán)圖的汽車或房屋。 我不買沒(méi)有人打了電話的手機(jī),沒(méi)有規(guī)格或詳細(xì)說(shuō)明。
In software, however, we often allow ourselves to be lulled in this regard. Terms such as “Agile” and “MVP” have crept in over time, and when misused / misunderstood, come to stand for “Just start coding and we’ll figure it out when we get to the end”.
但是,在軟件方面,我們經(jīng)常對(duì)此感到冷淡。 隨著時(shí)間的流逝,諸如“敏捷”和“ MVP”之類的術(shù)語(yǔ)逐漸流行起來(lái),當(dāng)被誤用/誤解時(shí),它們代表“剛開(kāi)始編碼,直到結(jié)束時(shí)我們才能弄清楚”。
Everyone is guilty in one way or another. Devs do it because that’s the stuff where they have expertise. POs do it because they want to see “productivity”, to see those stories keep moving. People sometimes do this because that’s all they know, that’s how they’ve always done it.
每個(gè)人都以一種或另一種方式有罪。 開(kāi)發(fā)人員之所以這樣做,是因?yàn)樗麄儞碛袑I(yè)知識(shí)。 PO之所以這樣做,是因?yàn)樗麄兿M吹健吧a(chǎn)力”,看到這些故事不斷發(fā)展。 人們有時(shí)這樣做是因?yàn)樗麄兯赖木褪撬麄円回炞龅降姆绞健?
Trust me when I say: Stop doing this. Stop trying to code your way out of the problem.
當(dāng)我說(shuō):別這樣做時(shí),請(qǐng)相信我。 停止嘗試編碼解決問(wèn)題的方法。
你該怎么辦? (What should you do?)
Now that we’ve decided to build this test harness, and WAY before we pick tech / solutions, let’s just nut out the expected behaviours we need from our test harness.
既然我們已經(jīng)決定構(gòu)建此測(cè)試工具,并且在選擇技術(shù)/解決方案之前選擇WAY,那么我們就來(lái)簡(jiǎn)單說(shuō)明一下我們的測(cè)試工具所需的預(yù)期行為。
An easy way to do this is just get a whiteboard, and draw a simple set of sequence diagrams showing the flow from start to finish.
一個(gè)簡(jiǎn)單的方法就是獲得白板,并繪制一組簡(jiǎn)單的序列圖,顯示從頭到尾的流程。
If you are keen and want to learn something new, try using PlantUML support for sequence diagrams to show the actions of all involved in a simple, easy-to-understand picture.
如果您熱衷于學(xué)習(xí)新知識(shí),請(qǐng)嘗試使用PlantUML支持的序列圖,以簡(jiǎn)單,易于理解的方式顯示所有參與者的動(dòng)作。
At the very minimum, you and your team should agree to and WRITE DOWN what the expected business behaviours are in your code changes. This is the contract, the blueprint of what is required. It is not a technical blueprint, but it IS a blueprint of what is needed for your software to be truly successful and bug-free.
至少,您和您的團(tuán)隊(duì)?wèi)?yīng)該同意并寫下代碼更改中預(yù)期的業(yè)務(wù)行為。 這是合同,是所需的藍(lán)圖。 這不是技術(shù)上的藍(lán)圖,但它是使軟件真正成功且無(wú)錯(cuò)誤所需的藍(lán)圖。
Here’s a simple diagram / plantuml blob to show you what I mean.
這是一個(gè)簡(jiǎn)單的圖表/ plantuml Blob,向您展示我的意思。
title Tester and the TestStub, Scenario 1: Send data to our APIactor TesterTester -> TestStub: Send data to our API
TestStub -> OurAPI: POST /some/url/ DataBlob
OurAPI -> TestStub: 200
Tester -> OurAPI: GET /some/url/for/datablob
alt if data is found
OurAPI -> Tester: 200 DataBlob
note left
:)
end note
else return nothing was found
OurAPI -> Tester: 404
note left
:(
end note
end
As you can see, this is pretty basic, and doesn’t take a lot of effort to create. What it does for the team’s understanding far outweighs the effort, and ensures everyone is clear about what the dev is going to make.
如您所見(jiàn),這是非常基本的,無(wú)需花費(fèi)很多精力進(jìn)行創(chuàng)建。 它對(duì)于團(tuán)隊(duì)的理解所做的工作遠(yuǎn)勝于努力,并確保每個(gè)人都清楚開(kāi)發(fā)人員將要做什么。
我為什么需要這個(gè)? (Why do I need this?)
The question which often arises at this point is “Well what do I need this for? I know what’s being built, so why not just build it?”
在這一點(diǎn)上經(jīng)常出現(xiàn)的問(wèn)題是“我需要什么呢? 我知道正在建造什么,為什么不僅僅建造它呢?”
Because I will bet dollars to doughnuts you DON’T know what’s being built. You are likely the victim of your own assumptions of what does what in this little exchange, and there is a strong likelihood that you could be assuming things no one else is assuming. The more complex the problem space, the more likely your assumptions are off-base, even by a little bit.
因?yàn)槲視?huì)把錢押在甜甜圈上,所以您不知道要建造什么。 您可能會(huì)在這種小小的交換中自己做某事的假設(shè)中受害,并且您很有可能會(huì)假設(shè)別人沒(méi)有其他假設(shè)。 問(wèn)題空間越復(fù)雜,您的假設(shè)就越有可能偏離基礎(chǔ),甚至有一點(diǎn)點(diǎn)偏離基礎(chǔ)。
Because writing down / diagramming each flow is a talking point for the team, something which helps everyone to be on the very same page as to what is being built, and thus what is going to be tested and delivered to our customer. These kinds of talking points lead to discussion, debate, clarification, all the things which make it ever more clear what is going to happen at a business / logical level.
因?yàn)閷懴?繪制每個(gè)流程是團(tuán)隊(duì)討論的重點(diǎn),所以可以幫助每個(gè)人將正在構(gòu)建的內(nèi)容,以及要測(cè)試并交付給客戶的內(nèi)容放在同一頁(yè)面上。 這些談話要點(diǎn)導(dǎo)致討論,辯論,澄清,所有這些使我們?cè)跇I(yè)務(wù)/邏輯層面上將要發(fā)生的事情變得更加清晰。
Because it’s all well and good that you ‘know it’ now, but you in a year or more, or a new team member, will have no way of knowing exactly what the test harness is, or what it actually does. Such documentation / diagrams / etc are a good way to keep knowledge debt at bay.
因?yàn)槟F(xiàn)在就知道它是一件好事,但是您在一年或一年以上的時(shí)間里,或者您是新團(tuán)隊(duì)成員,將無(wú)法確切知道測(cè)試工具的含義或?qū)嶋H用途。 這樣的文檔/圖表/等是避免知識(shí)欠債的好方法。
Because you will thank me for it when you approach software development this way, after even just one try.
因?yàn)楫?dāng)您以這種方式進(jìn)行軟件開(kāi)發(fā)時(shí),即使只嘗試一次,您也會(huì)感謝我。
到底 (In the End)
Next time you find yourself or someone leaping to implementation too soon, give this exercise a go. See if it helps. You can always go back to coding your way out of the problem if this isn’t for you.
下次您發(fā)現(xiàn)自己或某人過(guò)快地開(kāi)始實(shí)施時(shí),請(qǐng)嘗試一下。 看看是否有幫助。 如果不適合您,那么您總是可以返回編碼解決問(wèn)題的方法。
However, I have a sneaking suspicion that after a couple times doing this, you will see the benefit for all concerned. Coding your way out of the problem is often the cause of — not the solution to — delays and bugs and rework.
但是,我有一個(gè)偷偷摸摸的懷疑,即在經(jīng)過(guò)幾次此操作之后,您會(huì)看到所有相關(guān)人員的利益。 找出解決問(wèn)題的辦法通常是造成延遲,錯(cuò)誤和返工的原因,而不是解決方案。
Take some time to fully understand what you’re building before you crack on to build it.
在開(kāi)始構(gòu)建之前,需要一些時(shí)間來(lái)完全了解您正在構(gòu)建的內(nèi)容。
Hope this helps
希望這可以幫助
翻譯自: https://medium.com/it-dead-inside/stop-trying-to-code-your-way-out-of-the-problem-77d442a111ce
javaweb解決編碼問(wèn)題
總結(jié)
以上是生活随笔為你收集整理的javaweb解决编码问题_停止尝试编码解决问题的方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 陕西省综合管理计算机考试题,2013陕西
- 下一篇: 全国第四轮学科评估结果查询