首页|资源下载
登录|注册

您现在的位置是:首页 > 技术阅读 >  一则故事告诉你:编程又快,BUG又少的“秘诀”在哪?

一则故事告诉你:编程又快,BUG又少的“秘诀”在哪?

时间:2024-01-05


三个程序员被要求穿过一片田地,到达另一侧的房子。

(田地里有地雷)

菜鸟程序员目测了一下之间很短的距离,说:“不远!我只要十分钟。”

资深程序员看了一眼田地,想了一会,说:“我应该能在一天内过去。”菜鸟程序员很惊讶。

大神程序员看了一眼田地,说:“看起来要十分钟,但我觉得十五分钟应该够了。”

资深程序员冷笑了一声。

菜鸟程序员出发了,但只过了一会,地雷爆炸了,炸出了巨大的洞。这下他必须偏移预定的路线,原路返回,反复尝试穿过田地。最后他花了两天到达目的地,到的时候颤颤发抖,还受了伤。

资深程序员一出发就匍匐前进,仔细地拍打地面,寻找地雷,只有在安全的时候才前进。

他在一天的时间内小心谨慎地缓慢爬过了这片地,只触发了几个地雷。

大神程序员出发之后径直穿过了田地,十分果断。他只用了十分钟就到了另一边。

“你是怎么做到的?”另外两个人问道,“那些地雷怎么没有伤到你?”

“很简单,”他回答道,“我最初就没有埋地雷。”


原文出处:

https://www.quora.com/How-do-I-train-myself-to-code-faster-and-with-fewer-bugs/answer/Glyn-Williams



Glyn Williams's answer to How do I train myself to code faster and with fewer bugs?

Three programmers were asked to cross a field and go to the house at the other side.

The novice programmer looks at the short distance and says, "it's not far!.

That will take me ten minutes"The senior programmer looks at the field, thinks for a while and says "I should be able to get there in a day".

The novice looks surprised.

The ninja programmer looks at the field and says.

"Looks like ten minutes, but I think fifteen should be enough".

The senior programmer sneers.

The novice programmer sets off, but within a few moments, explosive land mines go off, blasting huge holes.

Taking him off course, and requiring him to double back and attempt the crossing many times.

It takes him two days to reach the goal.

Although he is shaking and injured when he arrives.

The senior programmer sets off on all fours.

And carefully taps the ground searching for mines, proceeding only when it is safe.

Slowly and meticulously he crosses the field over the course of the day.

Only setting-off a couple of mines.

The ninja programmer sets off, and walks directly across the field.

Purposefully and directly.

He arrives at the other side in just ten minutes.

"How did you do it"?, the others ask.

"How come the mines didn't get you?""Easy" he replies.

"I didn't plant any mines in the first place".

推荐阅读