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 69KB

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