javaweb解决编码问题_停止尝试编码解决问题的方法

javaweb解决编码问题

抽象 (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.

这是情况。 我需要构建一个测试工具,以验证当我的软件向其他系统(我无法控制的系统)发送/接收数据时,不仅收到了数据,而且实际上是我希望发送的数据。

Pretty standard test harness stuff, right? The testers say they need this for manual and for automation testing suites. Internal customer need. Great.

漂亮的标准测试装备,对吧? 测试人员说,他们需要手动和自动化测试套件。 内部客户需求。 大。

So the developer starts rattling off software tools / languages we will use to build this test harness.

因此,开发人员开始研究将用于构建此测试工具的软件工具/语言。

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?

我们如何从高层次的需求快速实现呢? 我们的要求在哪里? 我们的用户故事在哪里? 到底哪里有一些简单的序列/流程图来描述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.

好吧,开发人员认为他/她已经掌握了这些知识,因此有时间去学习有趣的东西,剪切代码的东西和实现。

Sound familiar?

听起来有点熟?

If so, then do everyone on the team a solid and pull the brakes before the conversation carries on down this line any further.

如果是这样,那么在对话继续进行下去之前,请团队中的每个人都站稳脚跟并刹车。

We’ve skipped a step, and it happens way more often than we might be willing to admit.

我们已经跳过了一步,而且发生的频率比我们可能愿意承认的要高。

两次测量,切一次 (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.

在构建任何东西之前,我需要尽可能地了解自己正在构建的东西才能开始工作。 我不仅在谈论软件。 您要建造鸟笼,甲板,露台家具吗? 所有这些东西(包括软件)都需要您清楚地了解正在建造的物品,并且可以从这张照片中出发,在第一时间立即进行建造。

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.

测量两次,切一次是古老的格言。 也就是说,在执行任何工作之前,请确保在执行任何操作之前已仔细检查了测量结果。 您对构建的内容了解得越多,成功构建它的机会就越大。

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.

在大多数行业中,这仍然成立:我不会买没有蓝图的汽车或房屋。 我不买没有人打了电话的手机,没有规格或详细说明。

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”.

但是,在软件方面,我们经常对此感到冷淡。 随着时间的流逝,诸如“敏捷”和“ MVP”之类的术语逐渐流行起来,当被误用/误解时,它们代表“刚开始编码,直到结束时我们才能弄清楚”。

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.

每个人都以一种或另一种方式有罪。 开发人员之所以这样做,是因为他们拥有专业知识。 PO之所以这样做,是因为他们希望看到“生产力”,看到这些故事不断发展。 人们有时这样做是因为他们所知道的就是他们一贯做到的方式。

Trust me when I say: Stop doing this. Stop trying to code your way out of the problem.

当我说:别这样做时,请相信我。 停止尝试编码解决问题的方法。

你该怎么办? (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.

既然我们已经决定构建此测试工具,并且在选择技术/解决方案之前选择WAY,那么我们就来简单说明一下我们的测试工具所需的预期行为。

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.

一个简单的方法就是获得白板,并绘制一组简单的序列图,显示从头到尾的流程。

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.

如果您热衷于学习新知识,请尝试使用PlantUML支持的序列图,以简单,易于理解的方式显示所有参与者的动作。

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.

至少,您和您的团队应该同意并写下代码更改中预期的业务行为。 这是合同,是所需的蓝图。 这不是技术上的蓝图,但它是使软件真正成功且无错误所需的蓝图。

Here’s a simple diagram / plantuml blob to show you what I mean.

这是一个简单的图表/ plantuml Blob,向您展示我的意思。

Image for post
title Tester and the TestStub, Scenario 1:  Send data to our API
actor 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.

如您所见,这是非常基本的,无需花费很多精力进行创建。 它对于团队的理解所做的工作远胜于努力,并确保每个人都清楚开发人员将要做什么。

我为什么需要这个? (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?”

在这一点上经常出现的问题是“我需要什么呢? 我知道正在建造什么,为什么不仅仅建造它呢?”

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.

因为我会把钱押在甜甜圈上,所以您不知道要建造什么。 您可能会在这种小小的交换中自己做某事的假设中受害,并且您很有可能会假设别人没有其他假设。 问题空间越复杂,您的假设就越有可能偏离基础,甚至有一点点偏离基础。

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.

因为写下/绘制每个流程是团队讨论的重点,所以可以帮助每个人将正在构建的内容,以及要测试并交付给客户的内容放在同一页面上。 这些谈话要点导致讨论,辩论,澄清,所有这些使我们在业务/逻辑层面上将要发生的事情变得更加清晰。

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.

因为您现在就知道它是一件好事,但是您在一年或一年以上的时间里,或者您是新团队成员,将无法确切知道测试工具的含义或实际用途。 这样的文档/图表/等是避免知识欠债的好方法。

Because you will thank me for it when you approach software development this way, after even just one try.

因为当您以这种方式进行软件开发时,即使只尝试一次,您也会感谢我。

到底 (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.

下次您发现自己或某人过快地开始实施时,请尝试一下。 看看是否有帮助。 如果不适合您,那么您总是可以返回编码解决问题的方法。

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.

但是,我有一个偷偷摸摸的怀疑,即在经过几次此操作之后,您会看到所有相关人员的利益。 找出解决问题的办法通常是造成延迟,错误和返工的原因,而不是解决方案。

Take some time to fully understand what you’re building before you crack on to build it.

在开始构建之前,需要一些时间来完全了解您正在构建的内容。

Hope this helps

希望这可以帮助

翻译自: https://medium.com/it-dead-inside/stop-trying-to-code-your-way-out-of-the-problem-77d442a111ce

javaweb解决编码问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值