结对编程
I’ve recently changed my thinking around “programming dogmas” — the things we do because we believe they’re best practice — because we’ve been told they are, even when our own experience does not back that up. They’re often presented as a silver bullet to solve all our problems — if it doesn’t work for you, you’re just not doing it right.
最近,我改变了对“编程教条”的思维方式-我们之所以这样做,是因为我们相信它们是最佳实践-因为有人告诉我们,即使我们自己的经验并不能证明这一点。 通常将它们作为解决我们所有问题的灵丹妙药-如果对您不起作用,您就是在做对了。
If a practice is essential, useful, and beneficial, why haven’t we embraced it as a community? Usually, this indicates that it’s either impractical, idealistic, over-hyped, or all of the above.
如果实践是必不可少的,有用的和有益的,为什么我们不将其作为一个社区来接受呢? 通常,这表明它要么不切实际,不理想,被过度炒作,要么以上所有。
A discussion about pair programming with other engineers usually goes like this: “Yeah I’ve heard it’s pretty good but I’ve never been able to really get into it.” So why? What’s keeping us from using pair programming if it’s so wonderful?
与其他工程师进行的结对编程讨论通常是这样的:“是的,我听说这很不错,但是我从来没有真正参与过。” 所以为什么? 如果太好了,是什么让我们无法使用结对编程?
But first, what are the benefits of pair programming?
但是首先,结对编程有什么好处?
学习Craft.io (Learning the craft)
Pair programming is a wonderful way for novices to pick up tips and tricks from coders with more experience to share. For example, using shortcut keys, creating snippets for regularly used code blocks, or easier ways to navigate the terminal.
对于新手来说,结对编程是一种很棒的方式,可以从编码人员那里获得更多经验,以分享技巧和窍门。 例如,使用快捷键,为常规使用的代码块创建代码片段,或导航终端的简便方法。
质量控制 (Quality control)
Two sets of eyes are better than one, so when both partners are paying attention it’s easier to spot issues and bugs ahead of time (note the caveat, you have to be on all the time).
两组的眼睛是比一个好,所以当双方都关注它更容易发现问题和错误的时间提前(注意警告,你必须在所有的时间)。
监督 (Oversight)
A bit more sinister, but if there are suspicions about a team member’s performance or abilities, pairing is one way to dig into what might be holding them up.
险恶一些,但是如果怀疑团队成员的表现或能力,配对是一种探究阻碍他们成长的方法。
格式更完善的解决方案 (More well-formed solutions)
Arguably, two people are more likely to come up with a better solution since they have unique perspectives on the problem.
可以说,两个人对这个问题有独特的看法,因此他们更有可能提出更好的解决方案。
共享的代码知识 (Shared knowledge of the code)
When all team members are always paired, it’s much harder to end up with a bus factor of one or “key person reliance”.
当所有团队成员始终配对在一起时,要以一个或“关键人员依赖”的总线因素来结束就更困难了。
These benefits sound awesome! I’ve attended several Global Days of Code Retreats, and visited these mystical companies that proclaim “we pair eight hours a day”. “Wow,” I think to myself, “these are real engineers”. But in the back of my head is a small voice wondering, “aren’t they all exhausted?”
这些好处听起来很棒! 我参加了几次全球代码务虚日活动,并参观了这些神秘的公司,这些公司宣称“我们每天配对八小时”。 “哇,”我对自己说,“这些都是真正的工程师”。 但是在我的脑后有一个小小的声音在想,“他们不是都累了吗?”
结对编程筋疲力尽 (Pair Programming is Exhausting)
If you lie somewhere on the more introverted side, this interaction will suck the very life out of you.
如果您躺在更内向的一面,这种互动将使您的生活陷于瘫痪。
Coding often requires a non-linear path through the problem, exploring and trying things out until you can settle on a clear way forward. Pairing takes a practice that’s normally filled with deep concentration and creativity and asks programmers to do that while also responding to social queues and norms that some of us find challenging at any time. In the time of COVID, we also need to perform this task over gxdlf (gxdlf fatigue is also a thing).
编码通常需要通过问题的非线性路径,进行探索和尝试,直到您找到明确的前进方向。 配对是一种通常充满深度专注和创造力的练习,要求程序员做到这一点,同时还要回应一些人有时会感到挑战的社交队列和规范。 在COVID期间,我们还需要通过gxdlf来执行此任务(gxdlf疲劳也是一件事情)。
I spoke to a former employee of one of these “pair programming only” shops and I asked them the question that was bothering me, “wasn’t it difficult to pair the whole day?” They responded that yes, it was tiring, and it was much easier to burn out, even just doing your day job.
我与其中一家“仅限结对编程”商店的一名前雇员交谈,我问他们一个困扰我的问题,“整天结对难吗?” 他们回答是的,这很累,而且筋疲力尽,甚至只是做日常工作。
Was the code quality better? Certainly. Is this a valuable practice that keeps us honest? For sure. Can I see myself working for a company like this? Debatable.
代码质量更好吗? 当然。 这是使我们保持诚实的宝贵做法吗? 当然。 我可以看到自己在这样的公司工作吗? 值得商。的。
Besides the personal hurdles to pairing, there are also some critical failures in the practice that also contribute to its adoption.
除了个人配对的障碍之外,在练习中还存在一些严重的失败,这也促使人们对其进行采用。
隐藏个人表演 (It hides individual performance) 美国高防vps
Depending on the skill levels of the paired team, it can be extremely beneficial to one member, but frustrating for the other. Yes, we want to teach each other, but you’re still expected to deliver at your own level and pairing too much can lead to your performance suffering. When it comes to the end of the quarter, the programmers in the team are all performing the same and it’s hard to distinguish who did what.
根据配对团队的技能水平,这可能对一个成员非常有益,但对另一个成员却令人沮丧。 是的,我们想互相教teach,但仍然希望您按自己的水平讲课,而过多的配对可能会导致您的演奏受到影响。 到本季度末,团队中的程序员们的表现都一样,很难区分谁做了什么。
Pairing is intended to be done between two evenly matched engineers. But in a small team, it’s usually intentionally made up of a variety of skill levels. When there’s more growing to be done on one side, it can be a hard balance to strike.
配对应在两名平均匹配的工程师之间完成。 但是,在一个小型团队中,通常是有意识地由各种技能水平组成的。 当一方面有更多的工作要做时,就很难达成平衡。
它使计划更加复杂 (It makes planning more complicated)
Depending on the company culture, it can be difficult to say why we need two people to do “one person’s job”. Project management types want to make charts and graphs, and that is hard to do if you can’t split work into tasks and people into resources. It’s still up for debate if pairing gets us moving faster. It costs more time upfront, but it may save time later during debugging and testing, which can be the most costly phase of development.
根据公司的文化,很难说为什么我们需要两个人来完成“一个人的工作”。 项目管理类型想要制作图表,如果您无法将工作分解为任务,而将人员分解为资源,则很难做到这一点。 配对是否可以使我们更快地移动尚有争议。 它花费了更多的前期时间,但可能会节省以后的调试和测试时间,这可能是开发中最昂贵的阶段。
That benefit of supporting, learning from, and directing each other, can still be achieved in other ways. For example, having brainstorming design sessions before sitting down to write code, having multiple check-ins along the way with senior engineers, and code review at the end.
相互支持,相互学习和指导的好处仍然可以通过其他方式实现。 例如,在坐下来编写代码之前进行头脑风暴的设计会议,与高级工程师一起进行多次签入,最后进行代码审查。
In the end, I use pair programming as a tool in the toolbox. When I get stuck, when I need more context, or when I’m impressed by someone and want to learn from them, I try to schedule an hour or two of pairing. Most of the time, it’s obvious that a pairing session is helpful. I normally notice it when there’s a long conversation, either over chat or video call, where everyone is hand waving and trying to translate code into English.
最后,我将结对编程用作工具箱中的工具。 当我陷入困境时,当我需要更多背景信息时,或者当我对某人印象深刻并想向他们学习时,我会尝试安排一两个小时的配对。 在大多数情况下,配对会议显然是有帮助的。 我通常会在聊天或视频通话中进行长时间对话时注意到这一点,每个人都在挥舞着手,试图将代码翻译成英语。
I’d encourage you to do the same and judge for yourself what works and what doesn’t in your current role. But always remember — just because something’s hard, doesn’t necessarily mean it is bad. Give everything a fair shot before forming an opinion.
我鼓励您做同样的事情,并自己判断在您当前的职位中什么有效,哪些无效。 但是请始终记住-仅仅因为有些困难,并不一定意味着它是坏的。 在形成意见之前,对所有内容进行公平的评估。
翻译自: https://medium.com/better-programming/pair-programming-fatigue-is-real-94702e61416f
结对编程