A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 73KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>On Pair Programming (archive) — David Larlet</title>
  13. <!-- That good ol' feed, subscribe :). -->
  14. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  15. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  16. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  17. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  18. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  19. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  20. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  21. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  22. <meta name="msapplication-TileColor" content="#f0f0ea">
  23. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  24. <meta name="theme-color" content="#f0f0ea">
  25. <!-- Documented, feel free to shoot an email. -->
  26. <link rel="stylesheet" href="/static/david/css/style_2020-06-19.css">
  27. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  28. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  29. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <script type="text/javascript">
  35. function toggleTheme(themeName) {
  36. document.documentElement.classList.toggle(
  37. 'forced-dark',
  38. themeName === 'dark'
  39. )
  40. document.documentElement.classList.toggle(
  41. 'forced-light',
  42. themeName === 'light'
  43. )
  44. }
  45. const selectedTheme = localStorage.getItem('theme')
  46. if (selectedTheme !== 'undefined') {
  47. toggleTheme(selectedTheme)
  48. }
  49. </script>
  50. <meta name="robots" content="noindex, nofollow">
  51. <meta content="origin-when-cross-origin" name="referrer">
  52. <!-- Canonical URL for SEO purposes -->
  53. <link rel="canonical" href="https://martinfowler.com/articles/on-pair-programming.html">
  54. <body class="remarkdown h1-underline h2-underline h3-underline hr-center ul-star pre-tick">
  55. <article>
  56. <h1>On Pair Programming</h1>
  57. <nav>
  58. <p class="center">
  59. <a href="/david/" title="Aller à l’accueil" tabindex="1">🏠</a>
  60. </p>
  61. </nav>
  62. <hr>
  63. <h2><a href="https://martinfowler.com/articles/on-pair-programming.html">Source originale du contenu</a></h2>
  64. <blockquote>
  65. <p>Betty Snyder and I, from the beginning, were a pair. And I believe that
  66. the best programs and designs are done by pairs, because you can criticise
  67. each other, and find each others errors, and use the best ideas.</p>
  68. <p class="quote-attribution">-- <a href="http://www.computerhistory.org/revolution/birth-of-the-computer/4/78/2258">Jean Bartik, one of the very first programmers</a></p>
  69. </blockquote>
  70. <blockquote>
  71. <p>Write all production programs with two people sitting at one machine.</p>
  72. <p class="quote-attribution">-- <a href="https://www.amazon.com/gp/product/0321278658?ie=UTF8&amp;tag=martinfowlerc-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321278658">Kent Beck</a><img src="https://www.assoc-amazon.com/e/ir?t=martinfowlerc-20&amp;l=as2&amp;o=1&amp;a=0321601912" border="0" alt=""/></p>
  73. </blockquote>
  74. <p>Jean Bartik was one of the <a href="https://en.wikipedia.org/wiki/ENIAC#Programmers">ENIAC women</a>, who are considered by many to be the very first programmers.
  75. They took on the task of programming when the word "program" was not even used yet,
  76. and there were no role models or books to tell them how to do this - and they
  77. decided that it would be a good idea to work in a pair. It took about 50
  78. more years for pair programming to become a widespread term, when
  79. Kent Beck described the term in his book "Extreme Programming" in the late
  80. 1990s. The book introduced agile software development practices to a wider
  81. audience, pairing being one of them. </p>
  82. <p>Pair programming essentially means that two people write code together on one machine. It is a very collaborative way of working and involves a lot of communication. While a pair of developers
  83. work on a task together, they do not only write code, they also plan and discuss
  84. their work. They clarify ideas on the way, discuss approaches and come
  85. to better solutions.</p>
  86. <p>The first part of this article, <a href="#HowToPair">"How to
  87. pair"</a>, gives an overview of different practical approaches to pair
  88. programming. It's for readers who are looking to get started with pairing,
  89. or looking to get better at it.</p>
  90. <p>The second and third parts, <a href="#Benefits">"Benefits"</a>
  91. and <a href="#Challenges">"Challenges"</a>, dive deeper into
  92. what the goals of pair programming are, and how to deal with the challenges
  93. that can keep us from those goals. These parts are for you if you want to
  94. understand better why pair programming is good for your software and your
  95. team, or if you want some ideas what to improve.</p>
  96. <p>Part four and five, <a href="#ToPairOrNotToPair">"To pair or not
  97. to pair?"</a>, and <a href="#ButReallyWhyBother">"But really, why bother?"</a>,
  98. will conclude with our thoughts on pairing in the grand scheme of team flow
  99. and collaboration.</p>
  100. <section id="HowToPair">
  101. <h2>How to pair</h2>
  102. <section id="Styles">
  103. <h3>Styles</h3>
  104. <section id="DriverAndNavigator">
  105. <h4>Driver and Navigator</h4>
  106. <p>These classic pair programming role definitions can be applied in
  107. some way or other to many of the approaches to pairing.</p>
  108. <p>The <b>Driver</b> is the person at the wheel, i.e. the keyboard. She is
  109. focussed on completing the tiny goal at hand, ignoring larger issues
  110. for the moment. A driver should always talk through what she is doing
  111. while doing it.</p>
  112. <p>The <b>Navigator</b> is in the observer position, while the driver is
  113. typing. She reviews the code on-the-go, gives directions and shares
  114. thoughts. The navigator also has an eye on the larger issues, bugs,
  115. and makes notes of potential next steps or obstacles.</p>
  116. <p>The idea of this role division is to have two different
  117. perspectives on the code. The driver's thinking is supposed to be more
  118. tactical, thinking about the details, the lines of code at hand. The
  119. navigator can think more strategically in their observing role. They
  120. have the big picture in mind.</p>
  121. <p>A common flow goes like this:</p>
  122. <ul>
  123. <li>Start with a reasonably well-defined task</li>
  124. <li>Agree on one tiny goal at a time. This can be defined by a unit
  125. test, or by a commit message, or written on a sticky note.</li>
  126. <li>Switch keyboard and roles regularly. Shared active participation
  127. keeps the energy level up and we learn and understand things
  128. better.</li>
  129. <li>As navigator, avoid the "tactical" mode of thinking, leave the
  130. details of the coding to the driver - your job is to take a step back
  131. and complement your pair's more tactical mode with medium-term
  132. thinking. Park next steps, potential obstacles and ideas on sticky
  133. notes and discuss them after the tiny goal is done, so as not to
  134. interrupt the driver's flow.</li>
  135. </ul>
  136. </section>
  137. <section id="PingPong">
  138. <h4>Ping Pong</h4>
  139. <p>This technique embraces <a href="https://martinfowler.com/bliki/TestDrivenDevelopment.html">Test-Driven Development</a> (TDD)
  140. and is perfect when you have a clearly defined task that can be
  141. implemented in a test-driven way.</p>
  142. <ul>
  143. <li>"Ping": Developer A writes a failing test</li>
  144. <li>"Pong": Developer B writes the implementation to make it pass.</li>
  145. <li>Developer B then starts the next "Ping", i.e. the next failing
  146. test.</li>
  147. <li>Each "Pong" can also be followed by refactoring the code together,
  148. before you move on to the next failing test. This way you follow the
  149. "Red - Green - Refactor" approach: Write a failing test (red), make it
  150. pass with the minimum necessary means (green), and then <a href="https://martinfowler.com/tags/refactoring.html">
  151. refactor</a>.</li>
  152. </ul>
  153. </section>
  154. <section id="Strong-stylePairing">
  155. <h4>Strong-Style Pairing</h4>
  156. <p>This is a technique particularly useful for knowledge transfer,
  157. described in much more detail by Llewellyn Falco <a href="https://llewellynfalco.blogspot.com/2014/06/llewellyns-strong-style-pairing.html">here.</a></p>
  158. <p>The rule: "For an idea to go from your head into the computer it
  159. MUST go through someone else's hands". In this style, the navigator is
  160. usually the person much more experienced with the setup or task at
  161. hand, while the driver is a novice (with the language, the tool, the
  162. codebase, ...). The experienced person mostly stays in the navigator
  163. role and guides the novice.</p>
  164. <p>An important aspect of this is the idea that the driver totally
  165. trusts the navigator and should be "comfortable with incomplete
  166. understanding". Questions of "why", and challenges to the solution
  167. should be discussed after the implementation session. In a setting
  168. where one person is a total novice, this can make the pairing much
  169. more effective.</p>
  170. <p>While this technique borders on micro-management, it can be a
  171. useful onboarding tool to favor active "learning by doing" over
  172. passive "learning by watching". This style is great for initial
  173. knowledge transfer, but shouldn't be overused. Keep in mind that the
  174. goal is to be able to easily switch roles after some time, and ease
  175. out of the micro management mode. That will be a sign that the
  176. knowledge transfer worked.</p>
  177. </section>
  178. <section id="PairDevelopment">
  179. <h4>Pair Development</h4>
  180. <p>"Pair Development" is not so much a specific technique to pair, but
  181. more of a mindset to have about pairing. (We first came across the
  182. term in <a href="https://twitter.com/sarahmei/status/877738639991611392">this thread</a> on
  183. Sarah Mei's Twitter account.) The development of a <a href="https://martinfowler.com/bliki/UserStory.html">user story</a> or a
  184. feature usually requires not just coding, but many other tasks. As a
  185. pair, you're responsible for all of those things.</p>
  186. <p>To help get you into the mindset, the following are a few examples
  187. of the non-coding activities in a story life cycle that benefit from
  188. pairing.</p>
  189. <section id="">
  190. <p class="pairing-subheading">Planning - what's our goal?</p>
  191. <p>When you first start working on something together, don't jump
  192. immediately into the coding. This early stage of a feature's life
  193. cycle is a great opportunity to avoid waste. With four eyes on the
  194. problem this early on, catching misunderstandings or missing
  195. prerequisites can save you a lot of time later.</p>
  196. <ul>
  197. <li><b>Understand the problem:</b> Read through the story and play back to
  198. each other how you understand it. Clear up open questions or potential
  199. misunderstandings with the Product Owner. If you have a
  200. <a href="https://www.agilealliance.org/glossary/definition-of-ready/">Definition of Ready</a> in your
  201. team, go through that again and make sure you have everything to get
  202. started.
  203. </li>
  204. <li><b>Come up with a solution:</b> Brainstorm what potential solutions for
  205. the problem are. You can either do this together, or split up and then
  206. present your ideas to each other. This depends on how well-defined the
  207. solution already is, but also on your individual styles. Some people
  208. like some time to think by themselves, others like talking things
  209. through out loud while they are thinking. If one of you is less
  210. familiar with the domain or tech, take some time to share the
  211. necessary context with each other.
  212. </li>
  213. <li><b>Plan your approach:</b> For the solution you chose, what are the steps
  214. you need to take to get there? Is there a specific order of tasks to
  215. keep in mind? How will you test this? Ideally, write these steps down,
  216. in a shared document or on sticky notes. That will help you keep track
  217. of your progress, or when you need to onboard somebody else to help work on the task. Writing this down also simply helps remember
  218. what needs to be done - in the moment, we too often underestimate how
  219. many things we will have forgotten even as quickly as the next
  220. day...
  221. </li>
  222. </ul>
  223. </section>
  224. <section id="">
  225. <p class="pairing-subheading">Research and explore</p>
  226. <p>When implementing a feature that requires you to use a technology
  227. you are both unfamiliar with, you'll have to do some research and
  228. exploration first. This work does not fit into the clean-cut
  229. "driver-navigator" or "ping-pong" approaches. E.g., browsing search
  230. engine results together on the same screen is usually not very
  231. effective.</p>
  232. <p>Here is one way to approach this in pair development mode:</p>
  233. <ul>
  234. <li>Define a list of questions that you need to answer in order to come
  235. up with a suitable solution.</li>
  236. <li>Split up - either divide the questions
  237. among you, or try to find answers for the same questions separately.
  238. Search the internet or other resources within your organisation to
  239. answer a question, or read up on a concept that is new to both of
  240. you.</li>
  241. <li>Get back together after a previously agreed upon timebox and
  242. discuss and share what you have found.</li>
  243. </ul>
  244. </section>
  245. <section id="">
  246. <p class="pairing-subheading">Documentation</p>
  247. <p>Another thing to work on together beyond the code is documentation.
  248. Reflect together if there is any documentation necessary for what
  249. you've done. Again, depending on the case at hand and your individual
  250. preferences, you can either create the documentation together, or have
  251. one of you create it, then the other review and word-smith.</p>
  252. <p>Documentation is a great example of a task where a pair can
  253. keep each other disciplined. It's often a task left for
  254. last, and when it's the last thing keeping us from the great feeling
  255. of putting our story into "Done", then more often than not, we skip
  256. it, or "wing it". Working in a pair keeps us honest about some of the
  257. valuable, but annoying things that we'll be very thankful for in the
  258. future.</p>
  259. </section>
  260. </section>
  261. </section>
  262. <section id="TimeManagement">
  263. <h3>Time management</h3>
  264. <p>In addition to the general styles for pairing, there are other little tools and techniques to make it easier.</p>
  265. <p>The pomodoro technique is ones of those tools. It is a time management method that breaks work
  266. down into chunks of time - traditionally 25 minutes - that are
  267. separated by short breaks. The technique can be applied to almost all
  268. of the pairing approaches described and will keep you focused. Pairing
  269. can be an exhausting practice, so it is helpful to get a reminder to
  270. take breaks and to switch the keyboard regularly.</p>
  271. <p>Here is an example of how using the pomodoro technique looks like
  272. in practice.</p>
  273. <ul>
  274. <li>Decide on what to work on next</li>
  275. <li>Set a timer for 25 minutes, e.g. with the help of the many pomodoro
  276. browser extensions - or even a real life tomato shaped kitchen
  277. timer...</li>
  278. <li>Do some work without interruptions</li>
  279. <li>Pause work when the timer rings - start with short breaks (5-10
  280. minutes)</li>
  281. <li>After 3 or 4 of these "pomodoros", take a longer break (15–30 minutes)</li>
  282. <li>Use the short breaks to <i>really</i> take a break and tank energy, get some water or
  283. coffee, use the bathroom, get some fresh air. Avoid using these short
  284. breaks for other work, like writing emails.</li>
  285. </ul>
  286. </section>
  287. <section id="PairRotations">
  288. <h3>Pair Rotations</h3>
  289. <p>Rotating pairs means that after working together for some time, one
  290. half of the pair leaves the story, while the other person onboards
  291. somebody new to continue. The person who stays is often called the
  292. "anchor" of a story.</p>
  293. <p>One category of reasons why to rotate is logistics. Your pairing
  294. partner could be sick or going on holiday. Or one of you is working
  295. remotely for a day, and the work requires physical presence on site, e.g.
  296. because there is a hardware setup involved.</p>
  297. <p>Another group of reasons why to rotate is to mix things up. Either
  298. the two of you have been working together for a while and are starting
  299. to show signs of "cabin fever" because you are spending too much time
  300. together. Or you're working on something very tedious and
  301. energy-draining - a rotation will give one of you a break, and a new
  302. person can bring in some fresh perspectives and energy.</p>
  303. <p>Finally, the most given reason for pair rotations is to avoid
  304. knowledge silos, increase collective code ownership, and get some more code
  305. review on-the-go. Pairing itself is already helping with those things,
  306. but rotations can further increase the average number of eyes on each
  307. line of code that goes to production.</p>
  308. <p>As to the ideal frequency of rotations, this is where opinions
  309. diverge. Some people believe that rotations every 2-3 days are crucial
  310. to ensure a sufficient knowledge spread and quality. Every rotation
  311. comes with some costs though. There's the time to onboard a new
  312. person, and the cost of a context switch for one of the two. If there
  313. is no constant anchor for continuity, the risk increases that tacit
  314. knowledge about the problem and solution space gets lost and triggers
  315. rework. For more junior developers it's sometimes more beneficial to
  316. stay on something for longer, so they have sufficient time to immerse
  317. themselves in a topic and give new knowledge time to settle.</p>
  318. <p>Think about the trade off between these costs and the benefits. For
  319. example, let's say you have high quality knowledge sharing already,
  320. with team "show and tells", readable code and good documentation. In
  321. that case, maybe an insistence on frequent rotations only marginally
  322. improves your collective code ownership, while creating high amounts
  323. of friction and overhead.</p>
  324. </section>
  325. <section id="PlanTheDay">
  326. <h3>Plan the Day</h3>
  327. <p>Pairing requires a certain level of scheduling and calendar
  328. coordination. If you don't take time to acknowledge and accommodate
  329. this, it will come back to haunt you later in the day.</p>
  330. <p>Start the day with a calendar check - agree with your pairing
  331. partner on how many hours you are going to pair, and see if you need
  332. to plan around meetings or time needed to work on other things outside
  333. of the pairing task. If it turns out that one of you will have to work
  334. by themselves for a while, then make sure to prepare for things to
  335. continue without the other person, e.g. by not using that person's
  336. computer to code.</p>
  337. <p>If you have meetings or other commitments during the day, make sure
  338. you have a reminder in place that you will notice, especially when
  339. working on your pairing partner's machine. If your team pairs by
  340. default, consider agreeing on regular "core coding hours" for
  341. everyone. This makes scheduling much easier.</p>
  342. </section>
  343. <section id="PhysicalSetup">
  344. <h3>Physical Setup</h3>
  345. <p>Pair programming means you need to work very closely together in
  346. the physical space of one shared desk. This is quite different from
  347. having your own table to spread out on. Being that close to one
  348. another requires a certain level of respect and attention for each
  349. other's needs. That is why it is worth spending some time figuring out
  350. a comfortable setup for both of you.</p>
  351. <ul>
  352. <li>Make sure both of you have enough space, clear up the desk if
  353. necessary.</li>
  354. <li>Is there enough space for both chairs in front of the desk? Get
  355. waste bins and backpacks out of the way.</li>
  356. <li>Do you want to use two keyboards or one? Same for the mouse, one or
  357. two? There's no clear rule that always works, we recommend you try out
  358. what works best for each situation. Some of the factors that play into
  359. this are hygiene, how good you are at sharing keyboard time, or how
  360. much space you have available.</li>
  361. <li>Do you have an external monitor available, or maybe even two? If
  362. not, you can also consider setting up some kind of screen sharing, as
  363. if you were remote pairing. In that setup, each of you would use their
  364. own laptop keyboards.</li>
  365. <li>Check with your partner if they have any particular preferences or
  366. needs (e.g. larger font size, higher contrast, ...)</li>
  367. <li>If you have an unusual keyboard/IDE setup check with your partner
  368. if they are okay with it. See if you can have a simple mechanism to
  369. switch your settings back to a more standard configuration for these
  370. situations.</li>
  371. </ul>
  372. <p>It is beneficial if your team can agree on a default setup, so that
  373. you don't have to discuss these things again and again.</p>
  374. </section>
  375. <section id="RemotePairing">
  376. <h3>Remote Pairing</h3>
  377. <p>Are you part of a distributed team, or some team members
  378. occasionally work from home? You can still practice pair programming, as long as both of you have reasonably stable internet access.</p>
  379. <section id="">
  380. <p class="pairing-subheading">The Setup</p>
  381. <p>For remote pairing, you need a screen-sharing solution that allows you to
  382. not only see, but also control the other person's machine, so that you are
  383. able to switch the keyboard. Many video conferencing tools today already
  384. support this, so if you're working at a company who has a license for a
  385. commercial VC tool, try that first. There are also open source tools for video
  386. calls with remote control, e.g. <a href="https://jitsi.org">jitsi</a>. For solutions
  387. that work at lower bandwidths, try things like <a href="https://www.hamvocke.com/blog/remote-pair-programming-with-tmux/">
  388. ssh with tmux</a> or the <a href="https://visualstudio.microsoft.com/services/live-share/">Live Share
  389. extension for Visual Studio Code</a>.</p>
  390. </section>
  391. <section id="">
  392. <p class="pairing-subheading">Tips</p>
  393. <ul>
  394. <li><b>Use video:</b> Since people communicate a lot through gestures and facial
  395. expressions it is nice to see the shared screen and your
  396. pairing partner's video at the same time. Some video conference solutions come with this feature; if yours doesn't, consider opening up an additional call in order to see each other. </li>
  397. <li><b>Planning and designing:</b> Use collaborative online visualization tools, to reproduce
  398. the experience of sketching out things on paper or a whiteboard.</li>
  399. <li><b>Audio experience:</b> Look for a quiet area and use a good headset, maybe even
  400. with a directional microphone. If you can't get away from the noise, "push to
  401. speak" functionality can also help. To avoid distractions on your side,
  402. noise-cancelling headphones are your friend.</li>
  403. <li>Dealing with network lag: It can be exhausting to work on a remote computer
  404. for a longer period of time when there is a network lag. So make sure to
  405. switch computers regularly, so that each of you has a chance to work on their
  406. own machine without lag. A network lag can also be annoying when you scroll
  407. through files because it can be hard to follow. It helps to avoid scrolling in
  408. long files, try to use keyboard shortcuts to open different parts of the file
  409. or use the collapse/uncollapse functionality instead.</li>
  410. </ul>
  411. </section>
  412. <section id="">
  413. <p class="pairing-subheading">The Human Part</p>
  414. <p>If you work in a setup where not the whole team is distributed and just one
  415. or a few of you are remote, try to include the remote partner in all
  416. discussions that are happening in the office. We tend to forget how much we
  417. share incidentally just by sitting in the same room.</p>
  418. <p>Working remotely with someone you haven't met and do not know creates an
  419. additional challenge. On the one hand, pairing is a chance to get closer to each
  420. other on a remote team. On the other hand, it's sometimes easy to forget that
  421. part of the collaboration. If there is no chance that you meet in person, think about other ways
  422. to get to know each other a bit better, e.g. try to have a remote coffee
  423. together.</p>
  424. <p>Finally, while remote pairing can have its challenges, it can also make it easier to focus than when pairing on site, because it
  425. is easier to blend out distractions with headphones on.</p>
  426. </section>
  427. </section>
  428. <section id="HaveADonutTogether">
  429. <h3>Have a Donut Together</h3>
  430. <p>Celebrate when you have accomplished a task together! High-fiving
  431. each other might seem corny, but it's actually a little "power pose"
  432. you can do together that can energize and get you ready for the next
  433. task. Or maybe you create your own way of celebrating success, like
  434. Lara Hogan, who celebrates career achievements with a <a href="https://larahogan.me/donuts/">
  435. donut</a>.</p>
  436. </section>
  437. <section id="ThingsToAvoid">
  438. <h3>Things to Avoid</h3>
  439. <p>The different approaches and techniques help you to have a
  440. better pairing experience. Here are a few common pitfalls to avoid:</p>
  441. <section id="">
  442. <p class="pairing-subheading">Drifting apart</p>
  443. <p>When you pair, avoid to read emails or to use your phone. These distractions might come across
  444. as direspectful to your pair, and they distract you from the task you are working on.
  445. If you really need to check
  446. something, make it transparent what you are doing, and why. Make sure that everyone has
  447. enough time to read their emails by taking enough breaks and reserving some
  448. individual time each day.</p>
  449. </section>
  450. <section id="">
  451. <p class="pairing-subheading">Micro-Management Mode</p>
  452. <p>Watch out for micro-management mode: It doesn't leave room for
  453. the other person to think and is a frustrating experience, if
  454. someone keeps giving you instructions like:</p>
  455. <ul>
  456. <li>"Now type 'System, dot, print, "...</li>
  457. <li>"Now we need to create a new class called..."</li>
  458. <li>"Press command shift O..."</li>
  459. </ul>
  460. </section>
  461. <section id="">
  462. <p class="pairing-subheading">Impatience</p>
  463. <p>Apply the "5 seconds rule": When the navigator sees the driver do
  464. something "wrong" and wants to comment, wait at least 5 seconds
  465. before you say something - the driver might already have it in mind,
  466. then you are needlessly interrupting their flow.</p>
  467. <p>As Navigator, don't immediately point out any error or upcoming
  468. obstacle: Wait a bit for the driver to correct or write a sticky
  469. note to remember later. If you intervene immediately, this can be
  470. disruptive to the driver's thinking process.</p>
  471. </section>
  472. <section id="">
  473. <p class="pairing-subheading">Keyboard Hogging</p>
  474. <p>Watch out if you're "hogging the keyboard": Are you controlling
  475. it all the time, not letting your pairing partner do some typing as well?</p>
  476. <p>This can be a really annoying experience for your pair and might cause them having
  477. a hard time focussing because of limited "active participation". Try
  478. one of the approaches described earlier to make sure that you switch
  479. the keyboard frequently.</p>
  480. </section>
  481. <section id="">
  482. <p class="pairing-subheading">Pairing 8 Hours per Day</p>
  483. <p>Teams that are really committed to making pair programming work
  484. sometimes end up pairing for 8 hours a day. In our experience, that
  485. is not sustainable. First of all it is just too exhausting. And
  486. secondly, it does not even work in practice because there are so
  487. many other things you do other than coding, e.g. checking emails,
  488. having 1:1s, going to meetings, researching/learning. So keep that
  489. in mind when planning your day and don't assume it will be 100%
  490. coding together.</p>
  491. </section>
  492. </section>
  493. <section id="ThereIsNottheRightWay">
  494. <h3>There is not "THE" right way</h3>
  495. <p>There are many approaches to pair programming and there is not
  496. "THE" right way to do it. It depends on your styles, personalities,
  497. experience, the situation, the task and many other factors. In the
  498. end, the most important question is: Do you get the promised benefits
  499. out of it? If this is not the case, try out something else, reflect,
  500. discuss and adjust to get them.</p>
  501. </section>
  502. </section>
  503. <section id="Benefits">
  504. <h2>Benefits</h2>
  505. <p>What is pair programming good for? Awareness of all its potential
  506. benefits is important to decide when you do it, how to do it well, and to
  507. motivate yourself to do it in challenging times. The main goals pairing
  508. can support you with are software quality and team flow.</p>
  509. <p>How can pairing help you achieve those goals then?</p>
  510. <section id="KnowledgeSharing">
  511. <h3>Knowledge Sharing</h3>
  512. <p>Let's start with the most obvious and least disputed benefit of
  513. pairing: Knowledge sharing. Having two people work on a piece of the
  514. code helps the team spread knowledge on technology and domain on a daily
  515. basis and prevents silos of knowledge. Moreover, when two minds
  516. understand and discuss a problem, we improve the chances of finding a
  517. good solution. Different experiences and perspectives will lead to the
  518. consideration of more alternatives. </p>
  519. <section id="">
  520. <p class="pairing-subheading">Practical Tips</p>
  521. <p>Don't shy away from pairing on tasks when you have no idea about
  522. the technology involved, or the domain. If you keep working in the
  523. area that you feel most comfortable in, you will miss out on learning
  524. new things, and ultimately spreading
  525. knowledge in your team.</p>
  526. <p>If you notice that a team member tends
  527. to work on the same topics all the time, ask them to mix it up to
  528. spread their expertise. It can also help to create a skill matrix with
  529. the team's tech &amp; business topics and each person's strengths and
  530. gaps in each area. If you put that on a wall in your team area, you
  531. can work together on getting a good spread of knowledge.</p>
  532. </section>
  533. </section>
  534. <section id="Reflection">
  535. <h3>Reflection</h3>
  536. <p>Pair programming forces us to discuss approaches and solutions,
  537. instead of only thinking them through in our own head. Saying and
  538. explaining things out loud pushes us to reflect if we really have the
  539. right understanding, or if we really have a good solution. This not only
  540. applies to the code and the technical design, but also to the user story
  541. and to the value a story brings.</p>
  542. <section id="">
  543. <p class="pairing-subheading">Practical Tips</p>
  544. <p>It requires trust between the two of you to create an atmosphere in
  545. which both of you feel free to ask questions and also speak openly
  546. about things you don't understand. That's why building relationships
  547. within the team becomes even more important when you pair. Take time
  548. for regular 1:1 and feedback sessions.</p>
  549. </section>
  550. </section>
  551. <section id="KeepingFocus">
  552. <h3>Keeping focus</h3>
  553. <p>It's a lot easier to have a structured approach when there are two of
  554. you: Each of you has to explicitly communicate why you are doing
  555. something and where you are heading. When working solo, you can get
  556. distracted a lot easier, e.g. by "just quickly" trying a different
  557. approach without thinking it through, and then coming back out of the
  558. rabbit hole hours later. Your pairing partner can prevent you from
  559. going down those rabbit holes and focus on what is important to finish
  560. your task or story. You can help each other stay on track.</p>
  561. <section id="">
  562. <p class="pairing-subheading">Practical Tips</p>
  563. <p>Make plans together! Discuss your task at hand and think about
  564. which steps you need to make to reach your goal. Put each of the steps
  565. on sticky notes (or if remotely, subtasks in your ticket management
  566. system), bring them in order and go one by one. Try this in
  567. combination with the <a href="#TimeManagement">Pomodoro technique</a> and try to finish one of the goals in one pomodoro.</p>
  568. <p>Never forget that communication is key. Talk about what you are
  569. doing and demand explanations from each other.</p>
  570. </section>
  571. </section>
  572. <section id="CodeReviewOn-the-go">
  573. <h3>Code review on-the-go</h3>
  574. <p>When we pair, we have 4 eyes on the little and the bigger things as
  575. we go, more errors will get caught on the way instead of after we're
  576. finished.</p>
  577. <p>The <a href="https://martinfowler.com/tags/refactoring.html">refactoring</a> of code is always part of coding, and therefore of pair
  578. programming. It's easier to improve code when you have someone beside
  579. you because you can discuss approaches or the naming of things for
  580. example.</p>
  581. <p>Doing code reviews after the fact has some downsides. We will dive
  582. more into this later, in <a href="#ToPairOrNotToPair">"To pair or
  583. not to pair?"</a>.</p>
  584. <section id="">
  585. <p class="pairing-subheading">Practical Tips</p>
  586. <p>Ask each other questions! Questions are the most powerful tool to
  587. understand what you are doing and to come to better solutions. If code
  588. is not easy to read and understand for one of you, try a different way
  589. that is easier to understand.</p>
  590. <p>If you feel the need to have more code review on pair programmed
  591. code, reflect if you can improve your pairing. Weren't you able to
  592. raise all questions and concerns during your pairing session? Why is
  593. that? What do you need to change?</p>
  594. </section>
  595. </section>
  596. <section id="TwoModesOfThinkingCombined">
  597. <h3>Two modes of thinking combined</h3>
  598. <p>As mentioned when we described the classic
  599. <a href="#DriverAndNavigator">driver/navigator</a> style
  600. earlier, pairing allows you to have different perspectives on the code.
  601. The driver's brain is usually more in "tactical" mode, thinking about
  602. the details, the current line of code. Meanwhile, the navigator's brain
  603. can think more strategically, consider the big picture, park next steps
  604. and ideas on sticky notes. Could one person combine these two modes of
  605. thinking? Probably not! Having a tactical and strategic view combined
  606. will increase your code quality because it will allow you to pay
  607. attention to the details while also having the bigger picture in
  608. mind.</p>
  609. <section id="">
  610. <p class="pairing-subheading">Practical Tips</p>
  611. <p>Remember to switch the keyboard and thus the roles regularly. This
  612. helps you to refresh, to not get bored, and to practice both ways of
  613. thinking.</p>
  614. <p>As navigator, avoid the "tactical" mode of thinking, leave the
  615. details of the coding to the driver - your job is to take a step back
  616. and complement your pair's more tactical mode with medium-term
  617. thinking.</p>
  618. </section>
  619. </section>
  620. <section id="CollectiveCodeOwnership">
  621. <h3>Collective Code Ownership</h3>
  622. <blockquote>
  623. <p>Collective code ownership abandons any notion of individual
  624. ownership of modules. The code base is owned by the entire team and
  625. anyone may make changes anywhere.</p>
  626. <p class="quote-attribution">-- <a href="https://www.martinfowler.com/bliki/CodeOwnership.html">Martin Fowler</a></p>
  627. </blockquote>
  628. <p>Consistent pairing makes sure that every line of code was touched or
  629. seen by at least 2 people. This increases the chances that anyone on the
  630. team feels comfortable changing the code almost anywhere. It also makes
  631. the codebase more consistent than it would be with single coders
  632. only.</p>
  633. <section id="">
  634. <p class="pairing-subheading">Practical Tips</p>
  635. <p>Pair programming alone does not guarantee you achieve collective
  636. code ownership. You need to make sure that you also rotate people
  637. through different pairs and areas of the code, to prevent knowledge
  638. silos.</p>
  639. </section>
  640. </section>
  641. <section id="KeepsTheTeamsWipLow">
  642. <h3>Keeps the team's WIP low</h3>
  643. <p>Limiting work in progress is one of the core principles of Kanban to
  644. improve team flow. Having a <a href="https://dzone.com/articles/the-importance-of-wip-limits">Work in Progress (WIP)
  645. limit</a> helps your team focus on the most important tasks. Overall
  646. team productivity often increases if the team has a WIP limit in place,
  647. because multi-tasking is not just inefficient on an individual, but also on the team level.
  648. Especially in larger teams, pair programming limits the number of things
  649. a team can work on in parallel, and therefore increases the overall
  650. focus. This will ensure that work constantly flows, and that blockers are
  651. addressed immediately.</p>
  652. <section id="">
  653. <p class="pairing-subheading">Practical Tips</p>
  654. <p>Limit your team's WIP to the number of developer pairs on your team
  655. and make it visible in your team space (or, if you work remotely, in your
  656. online project management tool). Have an eye on the limit before picking up
  657. new tasks. WIP limit discipline might naturally force you into a
  658. pairing habit.</p>
  659. </section>
  660. </section>
  661. <section id="FastOnboardingOfNewTeamMembers">
  662. <h3>Fast onboarding of new team members</h3>
  663. <p>Since pairing facilitates knowledge sharing it can help with the
  664. onboarding of new team members. New joiners can get to know the project,
  665. the business and the organisation with the help of their pair. Changes
  666. in a team have an impact on the team flow. People just need some time to
  667. get to know each other. Pair programming can help to minimize that
  668. impact, because it forces people to communicate a lot more than they
  669. need when working solo.</p>
  670. <section id="">
  671. <p class="pairing-subheading">Practical Tips</p>
  672. <p>It is not enough to just put new joiners into a pair, and then they
  673. are "magically" included and onboarded. Make sure to provide the big
  674. picture and broader context before their first pairing session, and
  675. reserve some extra time for the onboarding. This will make it easier
  676. for them to follow along and contribute during the pairing, and get
  677. the most out of it. Always use the new joiners' machine when pairing, to make sure that
  678. they are set up to work by themselves as well.</p>
  679. <p>Have an onboarding plan with a list of topics to cover. For some topics you might want to schedule dedicated sessions, for other topics the new
  680. team member can take the onboarding plan with her from pair to pair. If something is covered in
  681. the pairing session, you can check it off the list. This way
  682. the onboarding progress is visible to everyone on the team. </p>
  683. </section>
  684. </section>
  685. </section>
  686. <section id="Challenges">
  687. <h2>Challenges</h2>
  688. <p>While pair programming has a lot of benefits, it also requires practice and
  689. might not work smoothly from the start. The following is a list of some of the common challenges teams
  690. experience, and some suggestions on how to cope with them. When you come across
  691. these challenges, keep the benefits in mind and remember why you pair.
  692. It is important to know what you want to achieve with a practice, so that
  693. you can adjust the way you do it.</p>
  694. <section id="PairingCanBeExhausting">
  695. <h3>Pairing can be exhausting</h3>
  696. <p>When working alone, you can take breaks whenever you want, and your mind
  697. can drift off or shut down for a bit when it needs to. Pairing forces
  698. you to keep focus for potentially longer stretches of time, and find common ground
  699. with the other person's rhythm and ways of thinking. The increased focus
  700. is one of the benefits of pairing, but can also make it quite intense and
  701. exhausting.</p>
  702. <section id="">
  703. <p class="pairing-subheading">Ways to tackle</p>
  704. <p>Taking enough breaks is key to face this challenge. If you notice
  705. you are forgetting to take regular breaks, try scheduling them with an
  706. alarm clock, for example 10 minutes per hour. Or use a time management
  707. technique like <a href="#TimeManagement">Pomodoro</a>.
  708. Don't skip your lunch break: Get away from
  709. the monitor and take a real break. Pairing or not, taking breaks is
  710. important and increases productivity.</p>
  711. <p>Another important thing to prevent exhaustion is to not pair 8
  712. hours per day. Limit it to a maximum of 6 hours per day. Regularly
  713. switching roles from driver to navigator can also help to keep the
  714. energy level up.</p>
  715. </section>
  716. </section>
  717. <section id="IntenseCollaborationCanBeHard">
  718. <h3>Intense collaboration can be hard</h3>
  719. <p>Working so closely with another person for long stretches of time is
  720. intense. You need to communicate constantly and it requires empathy and
  721. interpersonal skills.</p>
  722. <p>You might have
  723. differences in techniques, knowledge, skills, extraversion,
  724. personalities, or approaches to problem-solving. Some combinations of those might
  725. not match well and give you a rocky start. In that case, you need to invest some time to
  726. improve collaboration, and make it a mutual learning experience instead of
  727. a struggle.</p>
  728. <section id="">
  729. <p class="pairing-subheading">Ways to tackle</p>
  730. <p>A conversation at the beginning of your pairing session can help
  731. you to understand differences between your styles, and plan to adapt
  732. to that. Start your first session with questions like "How do we want
  733. to work together?", "How do you prefer to pair?". Be aware of how you
  734. like to work and how you are efficient, but also don't be closed off
  735. to other approaches - maybe you'll discover something new. </p>
  736. <p>At the end of a day of pairing, do a round of feedback for each
  737. other. If the idea of giving feedback seems daunting to you, think
  738. about it more as a mini retrospective. Reflect on how you both felt
  739. during the pairing session. Were you alert? Were you tired? What made
  740. you feel comfortable, what not? Did you switch the keyboard often
  741. enough? Did you achieve your goals? Is there anything you would like
  742. to try next time? It's good to make this a routine early on, so you have
  743. practice in giving feedback when something goes wrong. </p>
  744. <p>There are excellent trainings and <a href="https://www.penguinrandomhouse.com/books/331191/difficult-conversations-by-douglas-stone-bruce-patton-and-sheila-heen/9780143118442/">
  745. books</a> that can help you deal with interpersonal conflicts and
  746. difficulties, for example on difficult conversations.</p>
  747. <p>Face the challenges as a team and don't leave conflicts to
  748. individuals. You can do this for example by organising a session on
  749. pairing in which you discuss how to deal with difficulties together.
  750. Start the session by collecting the benefits of pairing, so that you
  751. know what you all want to get out of it. Afterwards collect the
  752. challenges each individual feels when pairing. Now the group can think
  753. about which actions might help to improve. You could also collect the
  754. hot button triggers of the team members: What makes you immediately
  755. feel uncomfortable when pairing?</p>
  756. </section>
  757. </section>
  758. <section id="InterruptionsByMeetings">
  759. <h3>Interruptions by meetings</h3>
  760. <p>Have you ever had days full of meetings, and you get the impression
  761. you are not getting anything done? This probably happens in every
  762. delivery team. Meetings are necessary to discuss, plan and agree on
  763. things you are going to build, but on the other hand they interrupt the
  764. flow. When a team practices pair programming the effect of too many
  765. meetings can get even worse. If each of the persons pairing
  766. has meetings at different times, the interruptions are multiplied.</p>
  767. <section id="">
  768. <p class="pairing-subheading">Ways to tackle</p>
  769. <p>One approach is to limit the time slots in which meetings happen,
  770. for example by defining core pairing hours without meetings, or by
  771. blocking out no-meeting-times with rules like "no meetings after noon".</p>
  772. <p>It is also worth thinking about meeting length and overall amount.
  773. Which meetings do you really need? What goals do they have and how can
  774. you improve their quality, for example with proper preparation,
  775. facilitation, and a clear agenda.</p>
  776. <p>But one thing is for sure: There will always be meetings. So how to
  777. deal with that as a pair? Check your calendars together at the
  778. beginning of your pairing session, make sure you have enough time to
  779. start pairing at all. If you have any meetings consider attending them
  780. as a pair. Rely on your Product Owner, or other non-pairing team
  781. members, to keep interruptions away from the team in the core pairing
  782. hours.</p>
  783. </section>
  784. </section>
  785. <section id="DifferentSkillLevels">
  786. <h3>Different skill levels</h3>
  787. <p>When two people with different experience levels pair on a topic,
  788. this often leads to false assumptions on how much each of them can
  789. contribute, or frustrations because of difference in pace.</p>
  790. <section id="">
  791. <p class="pairing-subheading">Ways to tackle</p>
  792. <p>If your pair has more experience on the topic: Don't assume they
  793. know best. Maybe the need to explain why they are doing things the way they are
  794. will bring them new insights. Asking questions on
  795. the how and why can lead to fruitful discussions and better solutions.
  796. </p>
  797. <p>If your pair has less experience on the topic: Don't assume they
  798. cannot contribute much to the solution. You might be stuck wearing
  799. blinders and a different viewpoint can help you to come to a better
  800. solution. Also, remember that having to explain a concept is a great
  801. opportunity to test if you've really understood it and thought it all
  802. the way through.</p>
  803. <p>It also helps to be aware of different learning stages to
  804. understand how the learning process from novice to expert works. Dan
  805. North has described this very nicely in his talk <a href="https://www.youtube.com/watch?v=lvs7VEsQzKY">Patterns of Effective Teams</a>.
  806. He introduces the <a href="https://apps.dtic.mil/dtic/tr/fulltext/u2/a084551.pdf">Dreyfus Model of Skills
  807. Acquisition</a> as a way to understand the different stages of learning,
  808. and what combining them means in the context of pairing.</p>
  809. </section>
  810. </section>
  811. <section id="PowerDynamics">
  812. <h3>Power Dynamics</h3>
  813. <p>Dealing with power dynamics is probably one of the hardest challenges
  814. in this list. Pair programming does not happen in a space without
  815. hierarchies. There are formal hierarchies, for example between a manager
  816. and their report, and informal ones. Examples for informal hierarchies
  817. are:</p>
  818. <ul>
  819. <li>junior - senior</li>
  820. <li>non-men - men</li>
  821. <li>career changers - folks with a CS degree</li>
  822. <li>People of color - white folks</li>
  823. </ul>
  824. <p>And these are just a few. Power dynamics are fluid and
  825. intersectional. When two people pair, multiple of those dynamics can be
  826. in play and overlap. To get an idea of how power imbalance can impact
  827. pairing, here are a few examples. </p>
  828. <ul>
  829. <li>One person is dominating the pairing session by hogging the keyboard
  830. and not giving room to their pairing partner.</li>
  831. <li>One person stays in a teaching position and attitude all the
  832. time.</li>
  833. <li>One person is not listening to the other one, and dismissing their
  834. suggestions.</li>
  835. </ul>
  836. <p>It sometimes can be subtle to tie these situations back to
  837. hierarchies, you often just think that you don't get along with each
  838. other. But the underlying issue is often times influenced by an
  839. imbalance between the two folks pairing. </p>
  840. <p>Sarah Mei has written an <a href="https://twitter.com/sarahmei/status/991001357455835136">excellent
  841. series of tweets</a> on the topic and has also given a talk that
  842. covers <a href="https://www.youtube.com/watch?v=YL-6RCTywbc">power dynamics in agile</a> in
  843. a more general way.</p>
  844. <section id="">
  845. <p class="pairing-subheading">Ways to tackle</p>
  846. <p>The first step to tackle this is for the person on the upward side
  847. of the power dynamic to acknowledge and admit to themselves their
  848. position. Only then can you honestly reflect on interactions you have
  849. with your pairing partner, and how power dynamics impact them. Try to
  850. think about your own positionality and situatedness. What can you
  851. actively do to neutralize power imbalance?</p>
  852. <p>Recognizing these types of differences and adapting our behaviour
  853. to improve collaboration can be hard. It requires a lot of self
  854. reflection. There are trainings that can help individuals or teams
  855. with this, for example "anti-bias" or <a href="https://frameshiftconsulting.com/ally-skills-workshop/">
  856. ally skills</a> trainings.</p>
  857. </section>
  858. </section>
  859. <section id="PairingWithLotsOfUnknowns">
  860. <h3>Pairing with lots of Unknowns</h3>
  861. <p>When you work on a large topic where both of you don't have an idea
  862. how to solve a problem, the usual pairing styles often don't work as well.
  863. Let's say you need to use a technology for the first time, or try out a new approach or pattern.
  864. Researching and experimenting together works in some constellations,
  865. but it can also be frustrating because
  866. we all have different approaches to figuring out how things work, and we read
  867. and learn at different paces.</p>
  868. <section id="">
  869. <p class="pairing-subheading">Ways to tackle</p>
  870. <p>When there are lots of unknowns, e.g. you work with a new
  871. technology, think about doing a <a href="https://en.wikipedia.org/wiki/Spike_(software_development)">
  872. spike</a> to explore the topic and learn
  873. about the technology before you actually start working. Don't forget
  874. to share your findings with the team, maybe you have a knowledge
  875. exchange session and draw some diagrams you can put up in the team
  876. space.</p>
  877. <p>In these situations, remember to take on the mindset of <a href="#PairDevelopment">pair development</a>, as opposed to pair <i>programming</i>. It's okay to split up to do research - maybe after agreeing on the set of questions you need to answer together.</p>
  878. </section>
  879. </section>
  880. <section id="NoTimeForYourself">
  881. <h3>No time for yourself</h3>
  882. <p>We've talked about how being in a constant conversation with each other can be pretty energy draining. Most people also need some time on their own throughout the day. That is especially true
  883. for more <a href="https://www.ted.com/talks/susan_cain_the_power_of_introverts?language=en">introverted folks</a>.</p>
  884. <p>When working solo, we quite naturally take time to dig into a topic or learn when
  885. we need to. But that can feel like an interruption in pairing. So how can you take that alone and
  886. learning time when needed?</p>
  887. <section id="">
  888. <p class="pairing-subheading">Ways to tackle</p>
  889. <p>Again, don't pair 8 hours a day, agree on core coding hours with your team and
  890. keep it to a maximum of 6 hours per day. Maybe you also want to
  891. allocate a few hours self learning time.</p>
  892. <p>When a pair feels that they don't have the collective knowledge to
  893. approach a problem, split up to read up and share back, then continue
  894. implementation.</p>
  895. </section>
  896. </section>
  897. <section id="RotationsLeadToContextSwitching">
  898. <h3>Rotations lead to context switching</h3>
  899. <p>Knowledge sharing is one of the benefits of pairing, and we have mentioned how
  900. <a href="#PairRotations">rotations</a> can further increase that effect. On the other hand,
  901. too may rotations leat to frequent context switching.</p>
  902. <section id="">
  903. <p class="pairing-subheading">Ways to tackle</p>
  904. <p>Find a balance between frequency of rotations and the possibility for
  905. a new pairing partner to get enough context on the story and
  906. contribute properly. Don't rotate for the rotation's sake, think about
  907. if and why it is important to share a certain context, and give it enough time to be effective.</p>
  908. </section>
  909. </section>
  910. <section id="PairingRequiresVulnerability">
  911. <h3>Pairing requires vulnerability </h3>
  912. <blockquote>
  913. <p>To pair requires vulnerability. It means sharing all that you know
  914. and all that you don't know. This is hard for us. Programmers are
  915. supposed to be smart, really-crazy-smart. Most people look at what we do
  916. and say 'I could never do that.' It makes us feel a bit special, gives
  917. us a sense of pride and pride creates invulnerability.</p>
  918. <p class="quote-attribution">-- <a href="https://diaryofascrummaster.wordpress.com/2013/09/30/the-shame-of-pair-programming/">Tom Howlett</a></p>
  919. </blockquote>
  920. <p>When you pair, it can be hard to show that you don't know something, or feel insecure about a decision. Especially in
  921. an industry where myths like the <a href="https://www.thoughtworks.com/radar/techniques?blipid=201911057">10x engineer</a> regularly make their rounds, and where we have a tendency
  922. to <a href="https://blog.aurynn.com/2015/12/16-contempt-culture">judge each other</a> by what languages we use, or what design decisions we took 5 years ago.</p>
  923. <p>Vulnerability is often connected with weakness and in most modern
  924. cultures the display of strength is the norm. But as the researcher
  925. Brené Brown has laid out in several talks and books, vulnerability
  926. is actually a very important ingredient for innovation and change.</p>
  927. <blockquote>
  928. <p>Vulnerability is the birthplace of Innovation, Creativity and
  929. Change.</p>
  930. <p class="quote-attribution">-- <a href="https://www.youtube.com/watch?v=psN1DORYYV0">Brené Brown</a></p>
  931. </blockquote>
  932. <section id="">
  933. <p class="pairing-subheading">Ways to tackle</p>
  934. <p>Showing vulnerability requires courage and creating an environment
  935. where people feel safer to show that their vulnerable.
  936. Again, this is all about building teams where people trust each other
  937. (regular 1:1s, Feedback, culture where people can ask questions, etc)</p>
  938. <p>Being vulnerable is easier and less risky for people on the team who
  939. have more authority, either naturally (e.g. because they are well-respected
  940. already), or institutionally (e.g. because they have a title like "Tech
  941. Lead"). So it's important that those people start and role model this,
  942. making it the norm and therefore safer for others to be vulnerable as
  943. well.</p>
  944. </section>
  945. </section>
  946. <section id="ConvincingManagersAndCo-workers">
  947. <h3>Convincing managers and co-workers</h3>
  948. <p>Advocates of pair programming often struggle to convince their managers or their co-workers
  949. to make pairing part of a team's daily routine.</p>
  950. <section id="">
  951. <p class="pairing-subheading">Ways to tackle</p>
  952. <p>There is not a simple recipe to persuade others of the efficacy of pair programming. However,
  953. a key element should always be to take time to talk about it first, and make sure that everybody
  954. has the same understanding (e.g. by reading this article :-) ). Then find a way to try it out,
  955. either by starting with one pair who share their experience with the others, or by proposing a
  956. team experiment, like "let's pair by default for the next 2 sprints". Make sure to build in
  957. opportunities for feedback and retrospection to share what is going well and what you are struggling with.</p>
  958. <p>
  959. Ultimately, you can't force a practice on people, and it does not work for everybody. You might end up pairing
  960. with only a part of the team - at least in the beginning. From our experience the best way to convince people
  961. is by having a regular exposure to the practice, experiencing the benefits and fun their team members have while pairing.
  962. </p>
  963. <p>
  964. A question that comes up most frequently in this situation is the economics of the practice: Does pairing
  965. just cost double the money, and is it ultimately worth extra cost because of the increased quality and team benefits? There
  966. are a few studies on the topic, most notably <a href="https://collaboration.csc.ncsu.edu/laurie/Papers/XPSardinia.PDF">this one</a>, that are
  967. cited to provide evidence that pairing is worth it. We are wary though of attempts to "scientifically prove"
  968. pairing effectiveness. Software development is a process full of change and uncertainty, with a lot of outcome
  969. beyond lines of code that is hard to compare and measure, like analysis, testing, or
  970. <a href="https://martinfowler.com/articles/is-quality-worth-cost.html">quality</a>. Staunch opponents
  971. of pairing will always find ways to poke holes into the reproducibility of any "scientific" experiments set up
  972. to prove development productivity. In the end, you need to show that it works for YOU - and the only way to do
  973. that is to try it in your environment.
  974. </p>
  975. </section>
  976. </section>
  977. </section>
  978. <section id="ToPairOrNotToPair">
  979. <h2>To pair or not to pair</h2>
  980. <p>Our experience clearly shows that pair programming is a crucial
  981. practice to create high quality, maintainable software in a sustainable
  982. way (see <a href="#Benefits">"Benefits"</a>). However, we also
  983. don't believe it is helpful to
  984. approach it dogmatically and <i>always</i> pair. How exactly pair programming
  985. can be effective for you, how much of it, and for which tasks, can vary. We've
  986. found it useful to set pair programming as the "sensible default" on teams, and
  987. then discuss whenever we want to make an exception.</p>
  988. <p>Let's look at a few examples where it's helpful to balance how and when
  989. you pair.</p>
  990. <section id="BoringTasks">
  991. <h3>Boring Tasks</h3>
  992. <p>Some coding tasks are "boring", e.g. because they are about using
  993. some well defined boilerplate approach - so maybe you don't need to
  994. pair? The whole team already knows this type of approach, or it's very
  995. easy to grasp, so knowledge sharing is not that important? And live code
  996. review is less useful because the well-established pattern at hand has
  997. been used successfully in the past? So yes, maybe you don't need to
  998. pair.</p>
  999. <p>However, always consider that <a href="https://www.martinfowler.com/bliki/PairProgrammingMisconceptions.html">
  1000. rote tasks might be a smell for bad design</a>: Pairing can help you
  1001. find the right abstraction for that boring code. It's also more probable
  1002. to miss things or make cursory errors when your brain goes into "this
  1003. is easy" autopilot.</p>
  1004. </section>
  1005. <section id="couldIReallyDoThisByMyself">
  1006. <h3>"Could I Really Do This By Myself?"</h3>
  1007. <p>Pairing has a lot of benefits for programmers who are just starting
  1008. out, because it is an opportunity to learn relatively quickly from a
  1009. more experienced member of the team. However, junior programmers can
  1010. also experience a loss of confidence in their own abilities when
  1011. pairing. "Could I really do this without somebody looking over my
  1012. shoulder?". They also miss out on learning how to figure things out by
  1013. themselves. We all go through moments of frustration and unobserved
  1014. experimentation with debugging and error analysis that ultimately make
  1015. us better programmers. Running into a problem ourselves is often a
  1016. more effective learning experience than somebody telling us that we
  1017. are going to walk into it.</p>
  1018. <p>There are a few ways to counteract this. One is to let junior
  1019. programmers work by themselves from time to time, with a mentor who
  1020. regularly checks in and does some code review. Another way is letting
  1021. the more junior programmers on the team pair with each other. They can
  1022. go through finding solutions together, and still dig themselves out of
  1023. rabbit holes faster than if they were coding by themselves. Finally,
  1024. if you are the more experienced coder in a pair, make sure to be in
  1025. the navigator's seat most of the time. Give the driver space to figure
  1026. things out - it's sometimes just a matter of waiting a little bit
  1027. until you hit that next wall together, instead of pointing it out
  1028. beforehand.</p>
  1029. </section>
  1030. <section id="CodeReviewVs.Pairing">
  1031. <h3>Code Review vs. Pairing</h3>
  1032. <blockquote>
  1033. <p>The advantage of pair programming is its gripping immediacy: it is
  1034. impossible to ignore the reviewer when he or she is sitting right next
  1035. to you.</p>
  1036. <p class="quote-attribution">-- <a href="https://blog.codinghorror.com/pair-programming-vs-code-reviews/">Jeff Atwood</a></p>
  1037. </blockquote>
  1038. <p>Many people see the existence of a code review process as reason
  1039. enough not to need pair programming. We disagree that code reviews are a
  1040. good enough alternative to pairing.</p>
  1041. <p>Firstly, there are usually a few dynamics at play that can lead to
  1042. sloppy or superficial code reviews. For example, when coder and reviewer
  1043. rely too much on each other without making that explicit: The coder
  1044. might defer a few little decisions and improvements, thinking that
  1045. problems will be caught in the review. While the reviewer then relies on
  1046. the diligence of the coder, trusting their work and not looking too
  1047. closely at the code. Another dynamic at play is that of the <a href="https://www.behavioraleconomics.com/resources/mini-encyclopedia-of-be/sunk-cost-fallacy/">sunk cost fallacy</a>: We are usually
  1048. reluctant to cause rework for something that the team already invested
  1049. in.</p>
  1050. <p>Secondly, a code review process can disrupt the team's flow. Picking
  1051. up a review task requires a context switch for somebody. So the more
  1052. often code reviews occur, the more disruptive they will be for
  1053. reviewers. And they should occur frequently, to ensure continuous
  1054. integration of small changes. So a reviewer can become a bottleneck to
  1055. integrate and deploy, which adds time pressure - again, something that
  1056. leads to potentially less effective reviews.</p>
  1057. <p>With <a href="https://martinfowler.com/articles/continuousIntegration.html">Continuous Integration</a>
  1058. (and Delivery), we want to reduce risk by delivering small chunks of
  1059. changes frequently. In its original definition, this means practicing
  1060. <a href="https://paulhammant.com/2013/04/05/what-is-trunk-based-development/">trunk-based development</a>. With
  1061. trunk-based development, delayed code reviews are even less effective,
  1062. because the code changes go into the master branch immediately anyway.
  1063. So pair programming and continuous integration are two practices that go
  1064. hand in hand.</p>
  1065. <p>An approach we've seen teams use effectively is to pair by default,
  1066. but use pull requests and code reviews for the exceptional cases when
  1067. somebody has to change production code without pairing. In these setups,
  1068. you should carefully monitor as a team that your pull requests don't
  1069. live for too long, to make sure you still practice continuous
  1070. integration.</p>
  1071. </section>
  1072. </section>
  1073. <section id="ButReallyWhyBother">
  1074. <h2>But really, why bother?</h2>
  1075. <p>We talked a lot about the benefits of pair programming, but even more
  1076. about its challenges. Pairing requires a lot of different skills to get
  1077. it right, and might even influence other processes in the team. So why
  1078. bother? Is it really worth the hassle?</p>
  1079. <p>For a team to be comfortable with and successful at pair programming,
  1080. they will have to work on all the skills helpful to overcome its
  1081. challenges: Concentration and focus, task organisation, time management,
  1082. communication, giving and receiving feedback, empathy, vulnerability - and these
  1083. are actually all skills that help
  1084. immensely to become a well-functioning, collaborative and effective
  1085. team. Pairing gives everybody on the team a chance to work on these
  1086. skills together.</p>
  1087. <p>Another factor that is widely talked about today as a success factor
  1088. for effective teams is diversity. Diversity of perspectives, genders,
  1089. backgrounds and skills has proven to improve a team's performance - but
  1090. it often increases friction first. It can even increase some of the
  1091. challenges with pair programming we talked about. For example, one of
  1092. the key ingredients we suggested is showing vulnerability, which is
  1093. especially hard for team members of underrepresented groups.</p>
  1094. <p>Consider this headline from Harvard Business Review: <a href="https://hbr.org/2016/09/diverse-teams-feel-less-comfortable-and-thats-why-they-perform-better">"Diverse Teams Feel Less Comfortable - and That's
  1095. Why They Perform Better"</a>. The authors are making the point that
  1096. "Homogeneous teams feel easier - but easy is bad for performance. (...)
  1097. this idea goes against many people's intuitions". To explain, they point
  1098. out a cognitive bias called the fluency heuristic: "We prefer information
  1099. that is more easily processed, and judge it to be more true, or more
  1100. beautiful."</p>
  1101. <p>This bias makes us strive for simplicity, which serves us very well
  1102. in a lot of situations in software development. But we don't think it
  1103. serves us well in the case of pair programming. Pairing feels hard – but
  1104. that doesn't necessarily mean it's not good for a team. And most
  1105. importantly, it does not have to stay hard. In <a href="https://www.youtube.com/watch?v=S92vVAEofes">
  1106. this talk</a>, Pia Nilsson describes measures her team at Spotify took
  1107. to get over the uncomfortable friction initially caused by introducing
  1108. practices like pair programming. Among other things, she mentions feedback
  1109. culture, non-violent communication, <a href="https://hbr.org/2017/08/high-performing-teams-need-psychological-safety-heres-how-to-create-it">
  1110. psychological safety</a>, humility, and having a sense of purpose.</p>
  1111. <p>Pair programming, extreme programming, and agile software development
  1112. as a whole are all about embracing change. Agile software practitioners
  1113. acknowledge that change is inevitable, so they want to be prepared for
  1114. it.</p>
  1115. <p>We suggest that another thing we should embrace and prepare for is
  1116. friction, because it's also inevitable on the way to becoming a highly
  1117. effective, diverse team. By embracing friction we do NOT mean to say,
  1118. "let's just have lots of conflicts and we'll get better". What we mean
  1119. is that teams should equip themselves with the tools necessary to deal
  1120. with friction, and have them in their toolbox by default, not just when
  1121. the team is already having problems. Practice feedback, improve team
  1122. communication, take measures to create a psychologically safe
  1123. environment.</p>
  1124. <p>We believe that pair programming is often avoided because it can
  1125. create friction, but we would ask you to give it a chance. If you
  1126. consciously treat it as an improvable skill, and work on getting better
  1127. at it, you will end up with a more resilient team.</p>
  1128. </section>
  1129. </article>
  1130. <hr>
  1131. <footer>
  1132. <p>
  1133. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  1134. <a href="/david/log/" title="Accès au flux RSS">🤖</a> •
  1135. <a href="http://larlet.com" title="Go to my English profile" data-instant>🇨🇦</a> •
  1136. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">📮</a> •
  1137. <abbr title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340">🧚</abbr>
  1138. </p>
  1139. <template id="theme-selector">
  1140. <form>
  1141. <fieldset>
  1142. <legend>Thème</legend>
  1143. <label>
  1144. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  1145. </label>
  1146. <label>
  1147. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  1148. </label>
  1149. <label>
  1150. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  1151. </label>
  1152. </fieldset>
  1153. </form>
  1154. </template>
  1155. </footer>
  1156. <script src="/static/david/js/instantpage-3.0.0.min.js" type="module" defer></script>
  1157. <script type="text/javascript">
  1158. function loadThemeForm(templateName) {
  1159. const themeSelectorTemplate = document.querySelector(templateName)
  1160. const form = themeSelectorTemplate.content.firstElementChild
  1161. themeSelectorTemplate.replaceWith(form)
  1162. form.addEventListener('change', (e) => {
  1163. const chosenColorScheme = e.target.value
  1164. localStorage.setItem('theme', chosenColorScheme)
  1165. toggleTheme(chosenColorScheme)
  1166. })
  1167. const selectedTheme = localStorage.getItem('theme')
  1168. if (selectedTheme && selectedTheme !== 'undefined') {
  1169. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  1170. }
  1171. }
  1172. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  1173. window.addEventListener('load', () => {
  1174. let hasDarkRules = false
  1175. for (const styleSheet of Array.from(document.styleSheets)) {
  1176. let mediaRules = []
  1177. for (const cssRule of styleSheet.cssRules) {
  1178. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  1179. continue
  1180. }
  1181. // WARNING: Safari does not have/supports `conditionText`.
  1182. if (cssRule.conditionText) {
  1183. if (cssRule.conditionText !== prefersColorSchemeDark) {
  1184. continue
  1185. }
  1186. } else {
  1187. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  1188. continue
  1189. }
  1190. }
  1191. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  1192. }
  1193. // WARNING: do not try to insert a Rule to a styleSheet you are
  1194. // currently iterating on, otherwise the browser will be stuck
  1195. // in a infinite loop…
  1196. for (const mediaRule of mediaRules) {
  1197. styleSheet.insertRule(mediaRule.cssText)
  1198. hasDarkRules = true
  1199. }
  1200. }
  1201. if (hasDarkRules) {
  1202. loadThemeForm('#theme-selector')
  1203. }
  1204. })
  1205. </script>
  1206. </body>
  1207. </html>