📄 pairprogramming.html
字号:
<head><title>Pair Programming</title></head><body><h1><img src="logo.gif"> Pair Programming</h1><a href="http://c2.com/cgi/wiki?CategoryPairProgramming">CategoryPairProgramming</a>
<p>See: <a href="ProgrammingInPairs.html">ProgrammingInPairs</a>, <a href="http://c2.com/cgi/wiki?PairProgrammingDoubts">PairProgrammingDoubts</a>
<p><a href="PairProgramming.html">PairProgramming</a> requires two engineers to participate in one development effort at one workstation. Each member performs the action the other is not currently doing: While one types in <a href="UnitTests.html">UnitTests</a> the other thinks about the class that will satisfy the test, for example. Studies have shown that, after training for the "<a href="http://c2.com/cgi/wiki?PeopleSkills">PeopleSkills</a>" involved two programmers are more than twice as productive as one for a given task.
<p><a href="http://c2.com/cgi/wiki?RalphJohnson">RalphJohnson</a> hosts a mail list about pair programming ...
<p><UL><li> <a href="mailto:pair-programming@cs.uiuc.edu">mailto:pair-programming@cs.uiuc.edu</a>
<p></UL>Subscribe by sending email with the subject <em>subscribe</em> to ...
<p><UL><li> <a href="mailto:pair-programming-request@cs.uiuc.edu?subject=subscribe">mailto:pair-programming-request@cs.uiuc.edu?subject=subscribe</a>
<p></UL><em>This doesn't seem to be active. I </em>subscribed<em> in the beginning of May 2000, but I've yet (July 12, 2000) to get a response. -- <a href="http://c2.com/cgi/wiki?JeremyCromwell">JeremyCromwell</a></em>
<p><hr>
<p>Those mystified by the appearance of an inverse mathematical relationship to number of programmers available to draw tasks and the number of tasks completed need to read <a href="http://c2.com/cgi/wiki?PairProgrammingAsHoopShots">PairProgrammingAsHoopShots</a>.
<p>The second half of <a href="http://c2.com/cgi/wiki?MatrixManagement">MatrixManagement</a> [currently] contains a good case history of learning to pair despite management ... issues.
<p><hr>
<p><a href="http://c2.com/cgi/wiki?WardAndKent">WardAndKent</a> lead a BOF at OOPSLA'97 that included looking for patterns in the code and in the recorded dialog between programmers as they work together. These are the patterns they found ...
<p><UL><li> <strong>Let me drive.</strong> (One of the idioms of <a href="ProgrammingInPairs.html">ProgrammingInPairs</a>)
<li> <strong>x - 1 // n + 1</strong> (<a href="http://c2.com/cgi/wiki?FencePostErrors">FencePostErrors</a>?)
<li> <strong>inject:into:</strong>
<li> <strong>role suggesting variable name.</strong>
<li> <strong>trust me.</strong> (Sometimes you have an idea for how to do something, but not the words to explain it. "Trust me" gives you a couple of minutes to type it in without your partner stopping you.)
<li> <strong>look where you would write it.</strong> (When looking to see whether a method you need already exists, look in the place you would put it if you had to write it.)
<li> <strong><a href="http://c2.com/cgi/wiki?AskTheComputer">AskTheComputer</a>.</strong> (Don't reason about what will happen if you do X. Do X and see what happens. Send the message and see what it does.)
<li> <strong>multiple pens.</strong>
<li> <strong><a href="http://c2.com/cgi/wiki?BlameYourselfFirst">BlameYourselfFirst</a>.</strong>
<p></UL>Contributors: <a href="http://c2.com/cgi/wiki?MichaelFeathers">MichaelFeathers</a> <a href="http://c2.com/cgi/wiki?KatyMulvey">KatyMulvey</a> and others.
<p><hr>
<p>Just saw that I had marked (and forgotten) a section in "Constantine on Peopleware" in which he described a visit to Plauger's group, where they were programming in pairs, with the same descriptions as Ward and Kent use. Constantine called it "Dynamic Duo" development.
<p>That makes, so far, 3 or 4 separate inventions of this technique that I have encountered, each finding it advantageous. --<a href="http://c2.com/cgi/wiki?AlistairCockburn">AlistairCockburn</a>
<p><hr>
<p>In <a href="http://c2.com/cgi/wiki?PeopleWare">PeopleWare</a> Chapter 10, "Brain Time Versus Body Time," some statistics on the office environment are cited.
[Table 10.1, below.]
They state that workers spend certain percentages of their working hours working alone, together with another person, and working with two or more people. They go on saying "... it is during their solitary work periods that people actually <em>do</em> their work."
<p><strong>How Developers Spend Their Time</strong> (<a href="http://c2.com/cgi/wiki?PeopleWare">PeopleWare</a> Table 10.1)
<UL><li> 30% = Working alone.
<li> 50% = Working with one other person.
<li> 20% = Working with two or more people.
<p></UL>What about that in the light of <a href="PairProgramming.html">PairProgramming</a>? I agree with the authors of Peopleware in many aspects, so I would be surprised that they are wrong in that particular one. One answer might lie in the next section where they contemplate "flow" as the most productive work mode. Perhaps they just didn't notice that a pair could assume flow mode, too. Any comments? (Just an aside: a colleague suggested that flow mode is a myth anyway...) --<a href="http://c2.com/cgi/wiki?HaskoHeinecke">HaskoHeinecke</a>
[...with additional detail added by <a href="http://c2.com/cgi/wiki?JeffGrigg">JeffGrigg</a>]
<p><em>They didn't look for people working together, so they didn't see people working together. <a href="PairProgramming.html">PairProgramming</a> is new to lots of folks.</em>
<p><hr>
<p>But at that point in the book they were emphasizing that you need a <a href="http://c2.com/cgi/wiki?DistractionFreeEnvironment">DistractionFreeEnvironment</a> to be productive when working alone, and most modern office environments do the opposite.
<p>They noticed people spending half their time working with one other person.
Some of this may have been <a href="ProgrammingInPairs.html">ProgrammingInPairs</a>, but they were primarily concerned with the <a href="http://c2.com/cgi/wiki?MentalStateCalledFlow">MentalStateCalledFlow</a>, and the impact of interruptions/distractions.
-- <a href="http://c2.com/cgi/wiki?JeffGrigg">JeffGrigg</a>
<p><hr>
<p>Just a few days ago, I discovered JUNIT and I'm eager to try it at work. If I do the unit tests while the developer codes, does that count as <a href="PairProgramming.html">PairProgramming</a>?
<p>Even though
<UL><li> We are not literally working on the same module
<li> It is not literally simultaneous. I may be coding for a unit s/he wrote a few hours ago
<p></UL>--<a href="http://c2.com/cgi/wiki?CayteLindner">CayteLindner</a>
<p>It isn't <a href="PairProgramming.html">PairProgramming</a>. The writing of the tests informs the code, and vice versa, minute-by-minute. This isn't to say that what you describe is a bad practice, it just isn't <a href="PairProgramming.html">PairProgramming</a>.
<p><hr>
<p>See Also: <a href="http://c2.com/cgi/wiki?VirtualPairProgramming">VirtualPairProgramming</a>
<p><hr>
<p>See Also: <a href="http://c2.com/cgi/wiki?BasketballMetaphor">BasketballMetaphor</a>
<p><hr>
<p>What kinds of tasks are best performed alone?
<p>I have a little experience with pair programming and have become fully convinced of its value. But are there times when an individual needs to tackle a programming related problem alone? For example:
<p>I was trying to solve a programming design problem where every way I approached the problem it read every one of N records on the order of N-squared times. These solutions were of no use. Knowing what I do now, I would have tested them, implemented them, and started refactoring with one of my peers. At the time, I got one of my peers in front of a big blackboard and we invented a half dozen algorithms in three sessions over two days and proved that they were all N-squared. Two days later, with my feet propped up at my desk, I pushed through to an order-N algorithm and coded it up in an hour. Knowing what I know now, I would have penciled the pseudo-code while I had it in my head, then found someone to pair with in order to turn it into a program.
<p>If I had started off coding an order-N-squared version, would I have ever found the order-N algorithm? Would I have found something better? I submit that I would never have found the particular type of required backward thinking with someone else in the room. Of course we'll never know, but I was the man on the spot so my opinion is worth more than yours. Nor would I have found it without working through all the wrong options with another programmer.
<p>Hypothesis: If pairing off doesn't work, try working on it alone.
<p>Signed: George S. Cowan
HowCanSomeoneTypeTheirNameWithMidleInitialIncluded<a href="http://c2.com/cgi/wiki?edit=HowCanSomeoneTypeTheirNameWithMidleInitialIncluded">?</a>
<p><hr>
See also <a href="http://c2.com/cgi/wiki?PairLust">PairLust</a>
<hr>
Does anyone have experiences to relate abour <a href="http://c2.com/cgi/wiki?PairProgrammingInCpp">PairProgrammingInCpp</a>? --<a href="http://c2.com/cgi/wiki?PeteMcBreen">PeteMcBreen</a>
<hr>
<a href="http://c2.com/cgi/wiki?HeardOfDyads">HeardOfDyads</a>?
<p><hr>
I have begun close collaborative work with a colleague for both brainstorming design concepts and administrative work (contracts and the like) and have extended it to drawing designs white board style (use cases, etc) and even coding.
<p>We often work via connected workstations (PCAnywhere or other collaborative tools) and telephones with headsets. We find it to be very efficient as we have complimenary skillsets as well as a trusting relationship developed over the years. In addition, we have fun together which is probably the real reason why it seems to work.
<p>While we have occassionally sat at the same physical workstation trading off the keyboard, we find it more productive on connected workstations where we pass control back and forth quickly.
<p>Has anyone else worked like this?
<p>-- Don Robins
-- San Francisco
-- dbrobins@pacbell.net
<p><hr>
<p>Why not <a href="http://c2.com/cgi/wiki?TriProgramming">TriProgramming</a>?
<p><em>Read <a href="http://c2.com/cgi/wiki?PairProgrammingAsHoopShots">PairProgrammingAsHoopShots</a>. A third guy on the court could only interfere with the other two. --PCP</em>
<p><hr>
<p>I have personal experience with the <a href="PairProgramming.html">PairProgramming</a> method and it works. Well.
<p>However, I think finding the partner with whom you have that <strong>telepathic</strong> connection could be the hardest part. And there will always be folks who want to work alone.
<p>And as Don (see above) hinted to, trust is a big, big factor. You have to trust your partner and know them well. They will come to know you very well too.
<p>As far as I am concerned, this and <a href="ContinuousIntegration.html">ContinuousIntegration</a> are the 2 best lessons of <a href="ExtremeProgramming.html">ExtremeProgramming</a>.
<p><a href="http://c2.com/cgi/wiki?RonPerrella">RonPerrella</a>
<p><hr>
See <a href="http://c2.com/cgi/wiki?AlistairCockburn">AlistairCockburn</a>'s Article at <a href="http://members.aol.com/humansandt/papers/pairprogrammingcostbene/pairprogrammingcostbene.htm">http://members.aol.com/humansandt/papers/pairprogrammingcostbene/pairprogrammingcostbene.htm</a> for some hard data to refute the argument from management that <a href="PairProgramming.html">PairProgramming</a> is wasteful of man-hours.
<p>Sounds like an interesting concept, have to see how it plays out in day to day operations.
<p><hr>
Admitted, I haven't read the books yet. I've done things that sound a lot like pair programming before, and they were <strong>disastrous</strong>. I found myself less than 1/3 as productive as normal because my Significant Other needed so much hand-holding, explanation, language lesson, dispute, history, ... I spent the bulk of my time justifying each line of code, with destructive effect on my ability to hold a thought long enough to develop it.
<p>The experiences succeeded only when my SO hushed up and let me work, or when I returned the favor. In other words, they succeeded only when the pair dissolved. It's worked much better for me to run interference, defending my SO's solitude from others while [s]he got the job done (or accepting the return courtesy.)
<p>I really do like working in teams, but with more division of labor. Let me do what I do well. Help me by providing others who do well what I do badly. (This is reflexive by the way - I want to fill in others' lacks, also.) Keep the clutter out of my way, and I'll try to stay out from under your feet, too. For me, good fences make good neighbors.
<p>I don't <strong>dislike</strong> the pair programming idea. I just find it as incomprehensible as the idea that I should program while hanging upside-down by my heels. What is supposed to make it work?
<p>''You're supposed to get tired and make mistakes. If you get tired of detailed thinking, your partner takes the keyboard and you get to design for a while. If you make mistakes, your partner catches them in a small fraction of the time it would take you to catch them. I find that the "level set" discussions about formatting, approach, and IDE rapidly disperse (in a matter of days).
<p>TestFirstCoding<a href="http://c2.com/cgi/wiki?edit=TestFirstCoding">?</a> helps pair programming by making sure you know you're solving the same problem before you argue about how to solve it.''
<p>-- tvancourt
<p><em>Perhaps it would be helpful to consider that <a href="http://c2.com/cgi/wiki?PairProgrammingIsDoneByPeers">PairProgrammingIsDoneByPeers</a>. -- <a href="http://c2.com/cgi/wiki?RobHarwood">RobHarwood</a></em>
<p><hr>
<p>I've tried <a href="PairProgramming.html">PairProgramming</a> only a few times, but those times were far more productive than any I've had by myself. It's great fun, it's more efficient, and it helps me keep the right time and code perspective. I only wish I could do more of it. Since I'm the only programmer where I work, I've had to resort to <a href="http://c2.com/cgi/wiki?VirtualPairProgramming">VirtualPairProgramming</a> -- <a href="http://c2.com/cgi/wiki?ShaeErisson">ShaeErisson</a>
<p><hr>
I am trying to get <a href="PairProgramming.html">PairProgramming</a> introduced in my workplace, and mentioned the research that <a href="http://c2.com/cgi/wiki?LaurieWilliams">LaurieWilliams</a> has done on the benefits of pairing. Our QA manager was interested, but asked if there was any research done comparing <a href="PairProgramming.html">PairProgramming</a> with solo programming followed by a <a href="http://c2.com/cgi/wiki?CodeReview">CodeReview</a> (she is a big fan of reviews and inspections). I am sure that PP would be more effective, but does anyone have any hard data?
<p><hr><a href="http://c2.com/cgi/wiki?edit=PairProgramming">EditText</a> of this page (last edited February 9, 2001)<br><a href="http://c2.com/cgi/wiki?FindPage&value=PairProgramming">FindPage</a> by browsing or searching<p><font color=gray size=-1>This page mirrored in <a href="index.html">ExtremeProgrammingRoadmap</a> as of March 31, 2001</font></body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -