25
1 Chapter 1 Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of Extreme Programming, requires two developers work together on the same problem at the same time. The pattern of pair programming in which two individ- uals develop one software module together has attracted researcher and practitioner’s interest for almost 15 years . People following the pair programming protocol sit in front of one screen, use a set of keyboard and mouse to collabo- ratively solve a programming task [30]. While one devel- oper is modifying the source code, another is required to perform continuous code-review. This pattern was claimed by it advocators to yield earlier release and higher software quality [30], and was included as one of the rules of Ex- treme Programming (XP) [27], a popular software develop- ment methodology used widely in the software industry. Advocates claim pair programming to provide higher software quality with the same or minor additional effort. Despite the advantages proposed for pair programming, many still suspect the overall usefulness and benefit over traditional solo programming. One of the most ques- tioned aspects lies on the feasibility of achieving super- linear speedup as compared to the legacy pattern [30]. From a simple management’s viewpoint, there is no rea- son to pair up developers if they cannot do things twice faster. In addition to productivity, people also doubt if the

Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1

Chapter 1

Pair Programming

Chih-Song Kuo

1.1 IntroductionPair programming, asa rule of ExtremeProgramming,requires twodevelopers worktogether on the sameproblem at the sametime.

The pattern of pair programming in which two individ-uals develop one software module together has attractedresearcher and practitioner’s interest for almost 15 years .People following the pair programming protocol sit in frontof one screen, use a set of keyboard and mouse to collabo-ratively solve a programming task [30]. While one devel-oper is modifying the source code, another is required toperform continuous code-review. This pattern was claimedby it advocators to yield earlier release and higher softwarequality [30], and was included as one of the rules of Ex-treme Programming (XP) [27], a popular software develop-ment methodology used widely in the software industry.

Advocates claim pairprogramming toprovide highersoftware quality withthe same or minoradditional effort.

Despite the advantages proposed for pair programming,many still suspect the overall usefulness and benefit overtraditional solo programming. One of the most ques-tioned aspects lies on the feasibility of achieving super-linear speedup as compared to the legacy pattern [30].From a simple management’s viewpoint, there is no rea-son to pair up developers if they cannot do things twicefaster. In addition to productivity, people also doubt if the

Page 2: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

2 1 Pair Programming

improved software quality deserves hiring twice many pro-grammers [30]. Although pair programming is claimed tocost an insignificant 15% more effort yet achieve a higherquality than solitary programming on the same task [30],the paradigm is still questioned if solo programming plusan additional review phase, which might be cheaper andequally effective, will achieve the same goal.

Empirical researchon the effectivenessof pair programmingin both academic andindustrial settingsconcludeinconsistent findings.

While pair programming is suggested by Extreme Pro-gramming, it is unclear to what extent the setting isapplied and how effective it is in the software indus-try. Persuasive empirical evidence are still of relativeshortage. Earlier studies were mostly conducted in acourse room setting with college students being the sub-jects [30][20][8][24][25][19]. Despite the difference to theindustrial environment, the conclusion of these researchwere not entirely consistent. Certain weaknesses in thedesign of experiments, for example, small samples andshort programs, also threat the validity of their outcomes.Recently, a few more papers investigating the effect ofpair programming in the industrial setting were published[14][21][16][22][17][3]. However, due to their inconsistentfindings, it is still hard to tell whether pair programmingis really worth adopting. In a word, insufficient evidencefrom the research community restrains companies trans-forming their development pattern to pair programming.

A few implicationscan be inferred fromprevious studies tohelp practitionersbetter use pairprogramming.

Although it cannot be clearly concluded from previ-ous research whether pair programming reduces the de-velopment effort and meanwhile improves the quality ofthe artifacts, a few additional observations can be foundwhich might help practitioners know when is and how tomake pair programming more effective. Issues like underwhat situation pair programming appears to be advanta-geous are discussed. Some research begin to understandthe impact of pairing individuals with different levels ofexpertise[17][3]. Studies seeking a combined form of pairprogramming and solo programming are also published[18][15]. Furthermore, there are evidence showing that pairprogramming might help teaching activities in ComputerScience programs, for example, improving student confi-

Page 3: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.2 The Pattern of Pair Programming 3

dence and course performance [28].

This paperintroduces pairprogramming andexplores itseffectiveness basedon historicalresearch.

This seminar paper is organized as follows. In section 2a detailed description of pair programming including theorigin of the concept as well as the claimed advantages anddisadvantages will be given. In section 3 we do a thoroughreview of previous empirical research mainly on the evi-dence proving or disproving the effectiveness of pair pro-gramming. We investigate a few potential issues of pairprogramming based on recent publications in section 4. Inthe last section we conclude the research findings of pairprogramming.

1.2 The Pattern of Pair ProgrammingThe concept of pairprogramming can betraced back to 1975.Although pair programming seems to be a new pattern

of coding within about one decade, record shows that peo-ple practiced pair programming more than 35 years ago. Itwas in year 1975, when Fortran was the mainstream lan-guage, Jensen experimented pair programming in a teamof the United States Air Force and observed 2.27 timesspeedup and three order-of-magnitude improvement in er-ror rate [14]. In 1991, Flor introduced the idea of collabo-rating different individuals to overcome complex problems[11]. In 1995, Constantine stated in his book that ”Two pro-grammers in tandem is not redundancy; it’s a direct routeto greater efficiency and better quality” [9]. In the sameyear, Coplien named what he called ”Developing in Pairs”pattern [10]. There, programming in pairs was claimed tobe useful for solving big problems than programming in-dividually. That is, pairs are less likely to be sideblindedwhen they deal with software developing tasks.

ExtremeProgramming andLaurie William’sstudy promotes theuse of pairprogramming.

In 1998, another inspiring empirical study on the use ofthe pattern in industry came to being [2]. The article de-scribes a successful software project using Extreme Pro-gramming at Chrysler, where pair programming was en-forced and provided high quality of the resulting artifacts.One of the project member, Don Wells, later published ”The

Page 4: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

4 1 Pair Programming

Rules of Extreme Programming” [27] with one of them stat-ing ”All production code is pair programmed.” [27]. Therepair programming is defined as two developers workingtogether at a single computer on the same code. Wells sug-gests the setting that two programmers sit side by side infront of a screen and slide the keyboard and the mouse backand forth, which later confirmed by Williams by stating the”slide the keyboard/don’t move the chairs” rule as illus-trated in Figure 1.1 [33]. The one controlling the keyboardand mouse is called the driver, while another one reviewingand thinking is called the navigator. In addition, The rule

Figure 1.1: Suggested pair programming setting based on[33].

demands an adequate learning period of the pattern in or-der to get that pattern to work. It is claimed by the rule thatpair programming will yield the same productivity while abetter quality of code.

Potential pros andcons of pairprogramming aresummarized.

The inclusion of pair programming as a rule of ExtremeProgramming and Williams’s publication puts pair pro-gramming onto the stage and thus attracted reasonablymany discussions from the industry and the research com-munity. Pandey asserted that the new paradigm over-came four weaknesses of solo programming: steep learningcurve, single point of failure, too complex for one, inabil-ity to review work [22]. Despite the dispute on speedupand quality improvement, several possible additional ad-vantages and disadvantages are proposed as a result of cer-

Page 5: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.2 The Pattern of Pair Programming 5

tain observations. We summarize these points as follows:

1.2.1 AdvantagePair programming isclaimed to beadvantageous inseveral aspects,notably and arguablyon the developmentspeedup andsoftware qualityimprovement.

(1) Earlier task completion: Pair programming can poten-tially increase the development speed and thus shortentime-to-market. On the economic’s perspective, two de-velopers working in pairs is only superior when the re-sulting time is less than halved compared to individu-all programming. That is, two times speedup. How-ever, with the addition of other advantages, lower rateof speedup might also be acceptable [30]. Another use-ful situation could be an indivisible task on the criticalpath of a project. There pair programming is claimed tobe a helpful way accelerating the development [32].

(2) Higher software quality: Software quality is expectedto increase from pair-programming due to the ”twoheads are better than one” rule as well as continuouscode review. In practice, earlier fault removal is reallycritical. The longer defects remain in the product, themore costly it is to find and to fix them [30]. Reworkafter release can cost far more effort and possibly de-grade customer’s satisfaction. Different observations ofsoftware quality improvement can be found in [30].

(3) Smaller variance of effort: Smaller variance of effortmeans greater predicability of effort, which is consid-ered very beneficial in software project planning. Re-search [8][20]implied lower standard deviation of thetime needed for a pair programmed task.

(4) Smaller variance of quality: Studies [8] reported thatthe quality of software designs produced by pairs had70% less standard deviation. This advantage impliesbetter predicability of software reliability.

(5) Cross-learning: Several researchers identified inter-change of knowledge in the process of pair program-ming [30]. It should be noted that usually employeetraining is quite expensive.

(6) Positive peer pressure: Two developers working to-gether introduce pair pressure [29], which makes peo-

Page 6: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

6 1 Pair Programming

ple concentrated and punctual, and avoid them to getdistracted. Research [33] reported that the developersworking in pairs are far less likely to waste time read-ing e-mail, surfing the web, or zoning out the window -because their partner is awaiting continuous contribu-tion and input.

(7) Better code readability: Readability promotes ex-changeability of code and potentially lowers programmaintenance cost. Related evidence such as improvedconformance of coding standards and higher commentratio can be found in [21][13].

(8) Improved self-satisfaction: Self-satisfaction makes peo-ple happy at work and retains the talented staff. Thesurvey done in [30] reported that 90% programmers en-joyed pair programming more than solo programming.

(9) Improved self confidence: Self-confidence improvesone’s willingness and ability to solve complex tasks.Studies [30] showed that pair programmers were moreconfident.

(10) Decreased communication cost: Working in pair halvesthe communication needed for integration and thus re-duces additional effort in a large project team [30].

(11) Decreased integration effort: As the project was coarsepartitioned, the modules needed to be integrated ishalved [30].

(12) Reduce the chance of task misunderstanding: thechance that one person incorrectly interprets a require-ment is higher than two [20]. Correct interpretation ofthe task reduces additional rework.

(13) Early identification of faults: Due to continuous codereview, potential software faults can be identified ear-lier, where as in solo programming, a fault typically ex-ists until an appropriate code review or test is under-taken [30].

Page 7: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.2 The Pattern of Pair Programming 7

1.2.2 DisadvantageThe most criticizedpoint of pairprogramming is theincreased effort ofthe project.

(1) Lower productivity per developer: Pairs typically donot complete the task twice fast. Certain research[20][3] even reported an unchanged development timefor paired programmers. The observation implies twiceas many effort to be allocated for a project using pairprogramming.

(2) May easily get exhausted: Pair pressure makes one con-centrated on work but also makes one tired soon. Previ-ous research [29][33] indicated that pair programmingcould be a very intense and mentally exhausting.

(3) Incompatible pair harms: Pairs having incompatiblepersonalities or coding styles can make things evenworse and thus slow down the development progress[4].

(4) Scheduling challenge: Pairs must have exactly the sameschedule. This includes the same office hours, meetingminutes, which are usually difficult to enforce [4].

(5) Might not work for all characteristics: According to[30], it is said that ”Some have trouble working in pairs.Typically those with excess ego or too little ego.” In cer-tain cultures, high or low level of ego might be encour-aged. Thus pair programming might not work so wellin these contexts or need to be adapted.

(6) Slow down the genius: Sometimes the most talenteddevelopers refuse to be paired up with juniors as do-ing so might actually degrade her productivity. Ac-cording to the experiment conducted in [31], around 5%students, who were typically the top-performing ones,desired to work alone and did not want to be sloweddown.

(7) Require a pair jelling period: Whenever two program-mers who never worked in pair before are coupled to-gether, reasonable time is proved to be necessary for theindividuals to understand each other and to find a goodpattern of collaboration. Research [30][24] has indicateda relatively low productivity during this transition pe-riod.

Page 8: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

8 1 Pair Programming

(8) Hiring difficulties: IT professionals are constantly ina shortage such that even pair programming works,it might be challenging to hire reasonably many morequalified programmers [21]. In case the company canonly add less-experienced people to the team, wouldpair programming still outperform solo programming?

Concluding thepotential pros andcons of pairprogramming.

In a word, pair programming can bring plenty of benefitsto a development team. These typically include but not re-strict to progrees acceleration, quality upgrade, higher codereadability, and distraction avoidance. Advocates believethat these merits together actually decrease the total effortof a project, and lead to a better software product, a betterteam. While criticisms are more focused on the increasedeffort revealed in the empirical research, several furtheractivities that can potentially profit by the additional fac-tors might have been ignored. For example, integration ofmodules can be very time-consuming because of conflict-ing assumptions made by different individuals. Pair pro-gramming cuts this cost into half. Moreover, by producinghigher quality code in the beginning, pair programming re-duces later test and rework effort, which could be reason-ably high in some cases.

1.3 Empirical Experiments and StudiesThe findings on theimpact of pairprogramming todevelopmentspeedup andsoftware qualityimprovement aresummarized.

Although earlier empirical studies [14][2] accreditedpair programming so much, the pattern did not wentthrough smoothly as Extreme Programming did, but in-stead received noticeable criticism [5]. Among all, the eco-nomic feasibility was most frequently questioned. Skep-tics doubted about the doubled productivity brought frompair programming and thus consider it as a waste of re-sources compared to solo programming [30]. As a result,further quantitative evidence is needed to clarify the effec-tiveness. In the followings, we summarize the experimen-tal results of previous empirical research, with the focus on(1) the speed-up and (2) the software quality improvement,as these two measures are considered the most critical ones,for example, in [21].

Page 9: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.3 Empirical Experiments and Studies 9

Speedup Factor (SF)is defined as the ratioof the time neededby a solitary to a pair.

To make a standardized comparison, certain perfor-mance indices must be established. In this paper we definethe Speedup Factor (SF) as the ratio of duration needed bya solo programmer over a team of paired programmers toachieve the same functionality. That is,

SF =Time needed by a solo programmer

T ime needed by a team of paired programmers(1.1)

. When SF is 1, the same task takes a pair the same time asan individual programmer, which implies twice as manyefforts to be allocated. Having SF of 2, meaning that thetime needed by a pair is halved than a solo, is usually re-garded as the baseline for adopting pair programming dis-regarding other advantages such like quality improvement.Note that the comparison between the time spent by thetwo programming patterns is only valid when the samefunctionality and the level of quality are fixed. Neverthe-less this assumption is not guaranteed in several experi-ments we investigated. The reader (of this paper) shouldunderstand this bias when interpreting the respective num-bers.

Software QualityImprovement Factor(SQIF) is defined asthe ratio of thequality achieved by apair to a solitary.

We define the Software Quality Improvement Factor(SQIF) as the ratio of a quality index yielded from pair pro-gramming over solo programming. However, due to thediversity of quality measurement methods used in differ-ent research, defining SQIF explicitly is rather difficult. Inpractice, a quality index can be the number of passed testcases, the inverse of defect count or the defect density, etc.The reader should realize the possible influence made bydifferent quality measures to the SQIF index. When SQIFequals 1, pair programming yields the same quality of codeto solo programming. Having SQIF greater than 1 implieshigher software quality from the use of pair programming.

Empirical studiesmay be conducted ina university or in theindustry.

We classify the empirical research investigated by thetype of the subjects, which can be either college studentsor professionals that work in the industry. Part-time stu-dents who are simultaneously working as programmers are

Page 10: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

10 1 Pair Programming

Table 1.1: Studies with students being the subjects

Subject Task SF SQIF Test[30] 13

solos14pairs

Webunknownsize

Start: 1.3xLater: 1.8x

1.2x No

[20] 11solos5 pairs

C/C++300 LOC3 hours

1.0x 1.0x No

[8] 24peoplechangeroles

2h/task1 simple1 com-plex

Simple: 1.6xComplex:1.0x

N/A Yes

[24] 8 solos6 pairs

JAVA4000LOC

UC 1-10:1.4xUC 1-4:1.0xUC 5-10:2.1x

N/A Yes

[26] 30solos30pairs

C++45 hours

Simple: 1.1xComplex:1.8x

N/A Yes

[25] 15people

2 hours 1.3x 2x Yes

regarded as professionals. We make this distinction dueto the acclaimed difference of expertise between the twogroups which is sometimes questioned to threat the va-lidity of empirical research gained from a classroom set-ting. Skeptics sometimes regard students’ insufficiency ofknowledge and experience as one major cause to the opti-mistic pair programming experiment results. In practice,using student as subjects is convenient and economical,while implementing a controlled pair programming exper-iment in industry could be very costly and challenging.

Williams reported adecent speedup andmeaningful increasein software qualityfrom the use of pairprogramming.

We summarized the findings of empirical pair program-ming research in the academic setting in Table 1.1. The

Page 11: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.3 Empirical Experiments and Studies 11

field ”Test” indicates if certain statistical hypothesis testingwas performed in order to establish statistical significanceof the result. Among those research, the one that attractedsoftware practitioners the most were the experimental find-ings in University of Utah in 2000 by Williams [30]. Therea speedup of 1.8 times after the so-called pair jelling pro-cess was reported. Pair Jelling, as defined in [30], meansthe activities that a pair needs to get used to each other’sworking habit and make proper transitions. A jelled teamwas claimed there to yield much higher productivity. In thestudy, it is observed that 20% more test cases was passedfor pair-programmed artifacts. Though the conclusion wasrather bright, important parameters of the experiment suchas the type, length of the task were unknown, and no sta-tistical testing was performed. These issues somehow de-grades the paper’s persuasiveness.

Small scaleexperimentsconducted byNawrocki, Canfora,Padmanabhuni yieldrather conflictingresults.

Right after Williams, Nawrocki carried out a similar con-trolled experiment in Poznan University of Technology,Poland [20]. The result was, however, rather pessimistic.There was nearly neither improvement in the developmenttime nor enhancement in the program size and the numberof re-submissions to get the program pass an automatedtest. Nevertheless, a 50% standard deviation was observedfor the time needed by pairs compared to solos, which im-plied better predicability of effort estimation. Canfora [8]had an experiment focusing on productivity, where 1.6 and1.0 times of improvements were observed for one simpleand one complex task, respectively. Here it is rather coun-terintuitive that pair programming gained almost nothingin the more complex task. But still the study confirmeda much lower variance in the development duration forpairs. Another study [25] of a similar scale in terms of num-ber of subjects and program size instead reported more op-timistic numbers, with 1.3 times speedup and halved defectcounts. In summary, the above three research leads to con-flicting results. Nevertheless, it should be reminded thatthe programming tasks implemented in [20][8][25] wereonly about 150 to 400 lines of code or 2 hours of workingtime. Such size was apparently too small either in the in-dustrial setting or in terms of achieving statistical signifi-cance. Limited development time might also restrain pairs

Page 12: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

12 1 Pair Programming

to jell and thus prevented productivity improvements.

Empirical studieswith larger programsize are discussed. To overcome the threat from small program size, empir-

ical research that employees larger projects were carriedout. In 2005 it is observed from a Java project that pairprogramming can provide the speedup of 1.4 times over-all and 2.1 times in a later period of the project [24], whichagain suggests the potential influence of pair jelling. An-other more recent study [26] involving more subjects andabout 50-hour developing time had a bit worse findings,with 1.1x speedup and 1.5x speedup on the simple andcomplex tasks, respectively. Note that here the effective-ness of pair programming grows as the task difficulties in-creases.

The observation ofpair programming ina the classroomsetting was notconsistent but ratherbright.

In short, although the results reported from the experi-ments conducted in the classroom setting seem to be con-flicting, with [20] being the most exceptional one, the over-all trend was toward the positive side. In general, cer-tain improvement in both time and quality was observed.Specifically, the SF index was around 2 in [30][24][26]. Ifwe consider the additional benefit to software reliabilityand code readability improvement, adopting pair program-ming could be a good deal.

Industrial studies aremore difficult to carryout. Apart from the evidence found in college, we also sum-

marize the influences of pair programming in the context ofprofessionals in Table 1.2. Unlike students, companies areusually not willing to invest on a large-scale well-controlledexperiment where several teams of solo and pair program-mers are established to develop the same software product.Some research [21][16] overcame this problem by enforc-ing very small tasks. Lui and Arisholm conducted largerexperiments lasting approximately one day [17][3]. Stud-ies [14] [22][2][23] did not structure an experiment but in-stead compare different but similar projects using differentdevelopment patterns. Though the similarity between thecompared artifacts is to be questioned, these papers involveformal-executed projects of reasonably big size which wentinto production.

Page 13: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.3 Empirical Experiments and Studies 13

Table 1.2: Studies with professionals being the subjects

Subject Task SF SQIF Test[14] 10

peopleFortran50K LOC

2.3x threeorder

No

[21] 5 solos5 pairs

DBCC45 min

1.4x 1.3x Yes

[16] 5 solos5 pairs

Algorithmques-tionsCase 1:multiplechoiceCase 2:problem-solving

Case 1: 1.7xCase 2: 1.2x

Case 2:1.7x

No

[22] 9people

8500LOC

3.2x 1.7x No

[17] 8 solos8 pairs

SQL/Web7-10 h

1.5x N/A Yes

[3] 99solos98pairs

JAVA5-8 h

1.1x 1.1x Yes

Several studies in theindustrial settingusing small programsizes aresummarized.

As mentioned in the last section, Jensen reported a super-linear speedup and incredible quality enhancement adopt-ing pair programming in 1975 [14]. In 1998 Nosek car-ried out the first well-know controlled experiment in whichthe developers were asked to write a database consistencycheck script [21]. The task was indeed small so that it tookthe pairs and solos 30 and 43 minutes to finish. Artifactswere evaluated by two judges by the work’s READABIL-ITY and FUNCTIONALITY, which somehow outlined thelevel of quality. Pair-programmed script enjoyed 1.4 timeshigher READABILITY and 1.1 times higher FUNCTION-ALITY. In 2003, Lui [16] concluded that pairs solved al-gorithmic problems faster and reached much higher cor-rectness. A further study in 2006 conducted by the same

Page 14: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

14 1 Pair Programming

research group required the subjects to complete a FIFOwarehouse in a weekend. The experiment was called repeatprogramming such that the exactly same task was repeatedfour times by the same group of subjects. There the maingoal was to investigate the effectiveness of pair program-ming to a task with different level of familiarity. It followedthat pair programming contributed 1.5 times speedup inthe first try but then this number decreased dramaticallywith almost no speedup in the last iteration. This some-how confirmed the generally believed hypothesis that pairprogramming tends to be more beneficial to unfamiliar, dif-ficult tasks.

A large-scaleempirical researchinvolving about 300professionalsconcludesinsignificant effect ofpair programming.

The largest structured experiment in the industrial-setting might be [3]. There nearly 100 individuals and 100pairs of IT consultants from several international compa-nies such as Accenture, Oracle in Norway, Sweden, and UKparticipated in the study. Programmers were classified intothree categories: junior, intermediate, senior, according totheir expertise in Java, in order to further investigate the ef-fectiveness of pair programming among different groups.The task was to perform changes on a Java software sys-tem given a set of requirement. There was, however, nostatistical evidence showing any improvement to either de-velopment duration or correctness among all participants.Nevertheless, if we concern only subjects of certain level ofexpertise, then intermediate developers worked 1.4 timesfaster if they were paired up. Paired junior programmersproduced 1.7 times of correctness than those solo juniors.Specifically, if the difficulty of subtasks was considered,then the SQIF was 2.5 times for the juniors. In short, thestudy implied better efficiency when pairing-up intermedi-ate developers and higher quality when pairing-up juniordevelopers.

A company makingmedical productsshares a positiveexperience adoptingpair programming.

A process shift to a pattern similar to pair programmingwhich they called ”Tightly Coupled Engineering Team(TCET) ” in Guidant Corporation was reported [22]. Thetask, which consisted of about 8500 LOC, was to deliver anautomated testing program for an embedded health-caredevice. There were ten members working on the project.

Page 15: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.3 Empirical Experiments and Studies 15

Table 1.3: Speedup Factor and Effort Multiplier Conversion

Speedup F. Effort Mult. Speedup F. Effort Mult.0.6 3.33 1.6 1.250.8 2.50 1.8 1.111.0 2.00 2.0 1.001.2 1.67 2.2 0.911.4 1.43 2.4 0.83

Some reasons that motivated the transition to TCET were(1) code reviews were not effective, (2) it took too long tolearn and become effective, (3) it was difficult for projects torecover from setbacks of losing people. Nevertheless, TCETwas not strictly enforced but instead the project owner al-lowed the developers to decide when to pair-program. Inthe end the project was a successful one. A comparison toa previous similar project was then undertaken. Evidenceshowed no significant speedup but 40% defect density de-crease for the TCET project.

A table convertingSpeedup Factor toEffort Multiplier isprovided.

While in Table 1.1 and 1.2 the performance indexSpeedup Factor is used in order to provide a more intuitiveunderstanding, the management may be more interested inthe change of effort which directly relates to the project cost.For this purpose, a mapping between the Speedup Factorindex and Effort Multiplier is provided in Table 1.3. Hav-ing Effort Multiplier equivalent to one means no changefrom solo programming to pair programming. An EffortMultiplier greater than one indicates more effort to be allo-cated to a pair programmed project. For example, if EffortMultiplier equals 1.4, then 1.4 times of effort is needed com-pared to solo programming.

A few qualitativestudy in the industrialsetting issummarized.

Apart from Table 1.2, a few more experiences using pairprogramming in the industry are summarized. Accordingto Chrysler’s experience [2], the use of pair programmingled to fast progress, high quality artifacts, better readabil-ity, including consistent naming and similar coding style.It was reported that almost the only defect were written by

Page 16: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

16 1 Pair Programming

individual programmers.Vanhannen [23] summarized theperceived effects in a medium-sized Finnish software prod-uct company according to an internal survey. There pairprogramming was found to yield very positive effects oncross-learning, code-readability, and satisfaction, and smallyet clear reduction on defect density. Begel [4] did a sur-vey to Microsoft software developers on the topic of pairprogramming. The result indicated that 22% of the sur-veyed had been pair-programmed, but only 3.5% were us-ing the pattern in their current project. Those who haveinvolved in a pair-programming project reported the pat-tern’s top three benefits: fewer bugs, spread code under-standing, higher quality code, and top three problems: costefficiency, scheduling issues, and personality clash.

Evidence supportingthe use of pairprogramming issomehow weakerfrom the experimentsdone withprofessionals.

In summary, compared to the evidence implied from theacademic-setting, the findings based on software develop-ment professionals is a bit dull. Here the SF index seldomcame across 1.5, which seems to be less persuasive for themanagement to make a transition. Improved quality is onlyobserved in certain context, and might depend on the ex-pertise of developers.

Several potentialthreats mightinfluence the validityof previous research.

A few additional threats to the validity of previous men-tioned studies exist. For example, the subjects of the ex-periments were mostly new to pair programming, andthus might perform worse because they were not adaptedto. Also, the reader can easily observe from Table 1.1and 1.2 that the duration of several experiments were rela-tively short so the subjects might not have enough time tolearn how to pair programming well, and thus could notcome across the improvement ravine as claimed by [12].In some experiments[30], the pairs were formed by them-selves, which in turn potentially caused them to collaboratesmoothly. Nonetheless, this might not be the common casein a company, where each one’s partner is usually unpre-dictable.

Pair programming,based on previousempirical studies,does work, but mightnot be so effective asit was originallyclaimed.

In conclusion, most empirical studies implied a speedupbetween 1 and 2. Note that 1.5 times speedup means

Page 17: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.4 Discussion 17

roughly 30% additional effort to be allocated for eachtask. Quality enhancement brought by pair programmingis roughly confirmed, while the value of such improvementstill needs to be discussed.

1.4 DiscussionA mixture use of pairprogramming andsolo programming ispossible.

Having discovered the inconsistency of the effectivenessof pair programming revealed in previous empirical re-search, we now discuss the situations in which the patternmight be more beneficial than others or vice versa. In fact,according to the survey made in [33], 50% of the program-mers claimed working alone 10-50% of the time to be ac-ceptable.

Some tasks could bebetter doneindividually.According to previous surveys, programmers thought

that simple, well-defined, rote coding could be more effi-ciently done by a solitary programmer and then reviewedwith a partner instead of working in pairs. Detail-orientedtasks such as drawing the user interface were not recom-mended for pair programming. Many prefered to do exper-imental prototyping, tough, deep-concentration problems,and logical thinking alone [33][13]. This somehow impliesthat working individually could be more suitable for ex-ploring design alternatives, and prototyping [30][13]. Notethat doing so does not violate the Rules of Extreme Pro-gramming as long as the prototyped code will not be usedfor production [27]. In fact, exploring new problems indi-vidually might result more design choices and avoid somevaluable idea to be hindered.

Pair design could bevery beneficial.

While the focus of this paper is on pair programming, re-cently several studies indicated that working in pairs canbe beneficial in design activities. Several research [1][6][7]have reported different levels of quality improvement inpair-designed solution, which potentially decreases theprobability of proceeding to implementation with a baddesign. If an inappropriate design was made in the earlystage, it would be painful to revert in a later time step [30].

Page 18: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

18 1 Pair Programming

Al-Kilidar [1] carried out a structured experiment among150 final-year undergraduates including two design tasks.Design quality was measured according to functionality,usability, portability, and maintainability. 24% quality in-crease was observed in the first task while indifference ofquality was identified for the second task. Canfora carriedout an experiment in both academic and industrial settingreported that the solution worked out from a pair-designhad a statistically significant higher quality.

The effectiveness ofpair programmingmight depend on thedeveloper’s expertisewith respect to theproblem.

When coding, pairing-up junior developers can signifi-cantly reduce defect count, specifically for complex tasks[3]. Since each one’s level of expertise differs in eachfield, this result somehow implies that when the task istoo challenging such that one developer is hardly able totake, then pairing-up should be concerned instead. In ad-dition, Hulkko suggested using pair programming whenthere were many module dependencies in the project [13].Finally, pair testing, among all, was claimed to be the leastcritical one, as long as the pair developed the test cases to-gether. [30].

Pair programmingshould not be usedfor tutoring. While evidence shows pair programming can be good for

cross-training, the rule of Extreme Programming suggestsnot using pair programming for mentoring. It is said that”A teacher-student relationship feels very different fromtwo people working together as equals even if one has sig-nificantly more experience.” [27]. That said, cross-learningmight better be taken as a side affect of pair programming,but potentially not be the purpose.

Solitaryprogramming plusone additional reviewphase could resultthe same effort andreliability as pairprogramming did.

Since the speedup resulted from pair programming wasnot completely obvious, an alternative of solitary program-ming plus one additional review phase is considered toachieve the same quality instead [19]. A controlled exper-iment was conducted in University of Karlsruhe amongeight senior students to compare the difference of timespent and quality between pair programming and indi-vidual coding with code review. However result showed

Page 19: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

1.5 Conclusion 19

statistical indifference in both total effort and number ofpassed test cases.

Pair programmersneeds more frequentrests. Individualworks must bedeeply reviewed.

If one decided to adopt pair programming, some hintsare summarized as to improve the effectiveness. Sinceworking in pairs yields pair pressure, researchers suggeststaking a break periodically for maintaining the stamina foranother round of productive pair programming [33]. If notall work are done in pairs, then those artifacts completedindividually might better go through a thorough reviewbefore they are incorporate [30]. [29] also provided sev-eral tips for pair programming to work out. Typically theseincluded but not limited to: do not point out the mistakeinstantly, change role when one gets tired, find a matchedpartner, and resolve disagreement wisely.

A possibility ofcombining solo andpair programming isdiscussed.

While advocators of solo programming and pair pro-gramming seem to compete all the times without clear aresult, effort aiming at uniting the two process into onehas yet started [18][15]. These papers view solo and pairprogramming as two complementary processes instead ofcompeting ones. In [18] a new pattern called Software Pro-cess Fusion (SPF) was introduced, which promoted alterna-tions between solo and pair programming with several pre-defined transition conditions. For example, a change to soloprogramming when the task to be dealt was familiar or triv-ial. SPF was carried out in two companies’ IT departmentand yielded a very promising result. While the scale of theexperimented projects was small, these research point outa new direction toward merging the two processes [15]..

1.5 ConclusionPair programmingspeeds up thedevelopment butgenerally requiresmore efforts.

Pair programming, being a software development pat-tern that requires two programmers working on the sameproblem in front of the same screen using a set of inputdevices, typically speeds up the development around 1 to2 times, with the findings being more positive in the aca-demic setting than in the industrial setting. This result in-

Page 20: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

20 1 Pair Programming

dicates a potential increase of effort when choosing the pairprogramming pattern.

Pair programmingyields highersoftware quality andprovidesseveral otherbenefits.

In addition to economic efficiency, several benefits thatcould be brought from pair programming can be found inrecent empirical researches, with improved software qual-ity being the most remarkable one. Apart from that, pair-programmed code typically has better readability. De-velopers perform cross-learning when they are pairedand potentially gain much more self-satisfaction and self-confidence.

Pair programmingappears to beeffective only incertain contexts. Anew form ofprogramming patterncombining individualand pairprogramming is ondemand.

As pair programming does not perform consistently wellin all contexts, further investigations on the proper situa-tions to use the pattern are on demand. For example, theimpact of different pairing strategies is still not clear. Re-cent observations implies pair programming to be moreuseful in designing activities and complex, unfamiliar im-plementation tasks but maybe not for simple problems andtesting activities. Students and junior software engineersseem to benefit the most from pair programming. A com-bined programming paradigm extracting the merits of soloand pair programming is potentially on demand and to beinvestigated.

Page 21: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

21

Bibliography

[1] H. Al-Kilidar, P. Parkin, A. Aurum, and R. Jeffery.Evaluation of effects of pair work on quality of de-signs. In Proceedings of the 2005 Australian conference onSoftware Engineering, ASWEC ’05, pages 78–87, Wash-ington, DC, USA, 2005. IEEE Computer Society.

[2] A. Anderson, R. Beattie, K. Beck, D. Bryant, M. DeAr-ment, M. Fowler, Martin amd Fronczak, R. Garzaniti,D. Gore, B. Hacker, C. Hendrickson, R. Jeffries, D. Jop-pie, D. Kim, P. Kowalsky, D. Mueller, T. Murasky,R. Nutter, A. Pantea, and D. Thomas. Chrysler goes to”extremes”. Distributed Computing, pages 24–28, Oct.1998.

[3] E. Arisholm, H. Gallis, T. Dyba, and D. I.K. Sjoberg.Evaluating pair programming with respect to systemcomplexity and programmer expertise. IEEE Trans.Softw. Eng., 33(2):65–86, Feb. 2007.

[4] A. Begel and N. Nagappan. Pair programming: what’sin it for me? In Proceedings of the Second ACM-IEEE in-ternational symposium on Empirical software engineeringand measurement, ESEM ’08, pages 120–128, New York,NY, USA, 2008. ACM.

[5] B. Boehm and R. Turner. Balancing Agility and Disci-pline: A Guide for the Perplexed. Addison-Wesley, 2004.

[6] G. Canfora, A. Cimitile, C. Aaron Visaggio, F. Garcia,and M. Piattini. Performances of pair designing onsoftware evolution: a controlled experiment. In Pro-ceedings of the Conference on Software Maintenance andReengineering, CSMR ’06, pages 197–205, Washington,DC, USA, 2006. IEEE Computer Society.

Page 22: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

22 Bibliography

[7] G. Canfora, A. Cimitile, F. Garcia, M. Piattini, and C. A.Visaggio. Evaluating performances of pair designingin industry. J. Syst. Softw., 80(8):1317–1327, Aug. 2007.

[8] G. Canfora, A. Cimitile, and C. A. Visaggio. Empiricalstudy on the productivity of the pair programming.In Proceedings of the 6th international conference on Ex-treme Programming and Agile Processes in Software Engi-neering, XP’05, pages 92–99, Berlin, Heidelberg, 2005.Springer-Verlag.

[9] L. Constantine. Constantine on Peopleware. YourdonPress Computing Series. Yourdon Press, 1995.

[10] J. Coplien. A generative Development-Process PatternLanguage. Cambridge University Press, 1995.

[11] N. V. Flor and E. L. Hutchins. Analyzing distributedcognition in software teams: a case study of team program-ming during perfective software maintenance, pages 36–64. 1991.

[12] M. Fowler. Pairprogrammingmisconceptions, 2006.

[13] H. Hulkko and P. Abrahamsson. A multiple case studyon the impact of pair programming on product quality.In Proceedings of the 27th international conference on Soft-ware engineering, ICSE ’05, pages 495–504, New York,NY, USA, 2005. ACM.

[14] R. W. Jensen. A pair programming experience. TheJournal of Defense Software Engineering, Mar. 2003.

[15] K. Lui and K. Chan. Software process fusion by com-bining pair and solo programming. Software, IET,2(4):379 –390, aug. 2008.

[16] K. M. Lui and K. C. C. Chan. When does a pair out-perform two individuals? In Proceedings of the 4th in-ternational conference on Extreme programming and agileprocesses in software engineering, XP’03, pages 225–233,Berlin, Heidelberg, 2003. Springer-Verlag.

[17] K. M. Lui and K. C. C. Chan. Pair programmingproductivity: Novice-novice vs. expert-expert. Int. J.Hum.-Comput. Stud., 64(9):915–925, Sept. 2006.

Page 23: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

Bibliography 23

[18] K. M. Lui and K. C. C. Chan. Software process fu-sion: uniting pair programming and solo program-ming processes. In Proceedings of the 2006 internationalconference on Software Process Simulation and Modeling,SPW/ProSim’06, pages 115–123, Berlin, Heidelberg,2006. Springer-Verlag.

[19] M. M. Muller. Are reviews an alternative to pair pro-gramming? Empirical Softw. Engg., 9(4):335–351, Dec.2004.

[20] J. Nawrocki and A. Wojciechowski. Experimental eval-uation of pair programming. In Proceedings of the 12thEuropean Software Control and Metrics Conference, Apr.2001.

[21] J. T. Nosek. The case for collaborative programming.Commun. ACM, 41(3):105–108, Mar. 1998.

[22] A. Pandey, N. Kameli, A. Eapen, C. Miklos,F. Boudigou, I. Sutedjo, M. Paul, V. Vijay, and W. Mc-dermott. Application of tightly coupled engineeringteam for development of test automation software - areal world experience. Computer Software and Applica-tions Conference, Annual International, 0:56, 2003.

[23] J. Vanhanen and P. Abrahamsson. Perceived effectsof pair programming in an industrial context. In Pro-ceedings of the 33rd EUROMICRO Conference on SoftwareEngineering and Advanced Applications, EUROMICRO’07, pages 211–218, Washington, DC, USA, 2007. IEEEComputer Society.

[24] J. Vanhanen and C. Lassenius. Effects of pair program-ming at the development team level: an experiment.In ISESE, pages 336–345. IEEE, 2005.

[25] M. Y. S. M. Venkata Vinod Kumar Padmanabhuni,Hari Praveen Tadiparthi. Effective pair programmingpractice- an experimental study. Journal of EmergingTrends in Computing and Information Sciences, 3(4):471–479, Apr. 2012.

[26] V.Venkatesan and A.Sankar. Adoption of pair pro-gramming in the academic environment with different

Page 24: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

24 Bibliography

degree of complexity in students perspective an em-pirical study. International Journal of Engineering, Sci-ence and Technology, 2(9), 2010.

[27] D. Wells. The rules of extreme programming, 1999.

[28] L. Williams. Pair Programming. Oreilly Series. O’ReillyMedia, Incorporated, 2010.

[29] L. Williams and R. Kessler. Pair Programming Illumi-nated. Addison-Wesley Longman Publishing Co., Inc.,Boston, MA, USA, 2002.

[30] L. Williams, R. R. Kessler, W. Cunningham, and R. Jef-fries. Strengthening the case for pair programming.IEEE Softw., 17(4):19–25, July 2000.

[31] L. Williams, D. S. McCrickard, L. Layman, and K. Hus-sein. Eleven guidelines for implementing pair pro-gramming in the classroom. In Proceedings of the Ag-ile 2008, AGILE ’08, pages 445–452, Washington, DC,USA, 2008. IEEE Computer Society.

[32] L. Williams, A. Shukla, and A. I. Anton. An initialexploration of the relationship between pair program-ming and brooks’ law. In Proceedings of the Agile Devel-opment Conference, ADC ’04, pages 11–20, Washington,DC, USA, 2004. IEEE Computer Society.

[33] L. A. Williams and R. R. Kessler. All i really needto know about pair programming ilearned in kinder-garten. Commun. ACM, 43(5):108–114, May 2000.

Page 25: Pair Programming - Software engineering › ... › xp › 2012b › seminar › 4-pairprogra… · Pair Programming Chih-Song Kuo 1.1 Introduction Pair programming, as a rule of

Typeset August 7, 2012