Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working...

7
+ Robert Kessler School of Computing University of Utah Special thanks to Laurie Williams North Carolina State University Pair Programming CS312 Spring 2012 L12pp - 1 Slides adapted from: Bob Kessler and Laurie Williams + Admin Assignment 4 scores sent out Assignment 5 soon… Tech talk schedule set If you need to change for some reason negotiate with others in the class send me an e-mail with the update + Admin Project Make sure to keep track of your sprint updates Git use branches for major features figure out practices as a team what work best communication is crucial! http://kentnguyen.com/development/visualized- git-practices-for-team/ + Admin Project Pep talk this is new for everyone it’s going to take a while to figure out where the project is going working in a new team is challenging rails is new for most of you I understand all of this… don’t get frustrated just keep putting in the time you’ll get there… baby steps!

Transcript of Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working...

Page 1: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+

Robert Kessler School of Computing University of Utah Special thanks to Laurie Williams North Carolina State University

Pair Programming CS312

Spring 2012

L12pp - 1

Slides adapted from: Bob Kessler and Laurie Williams

+Admin

n  Assignment 4 scores sent out

n  Assignment 5 soon…

n  Tech talk schedule set n  If you need to change for some reason

n negotiate with others in the class

n  send me an e-mail with the update

+Admin n  Project

n Make sure to keep track of your sprint updates

n Git

n use branches for major features n  figure out practices as a team what work best n communication is crucial!

n http://kentnguyen.com/development/visualized-git-practices-for-team/

+Admin n  Project

n Pep talk J n  this is new for everyone n  it’s going to take a while to figure out where the

project is going n  working in a new team is challenging n  rails is new for most of you n  I understand all of this…

n don’t get frustrated n just keep putting in the time n you’ll get there… baby steps!

Page 2: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+What is pair programming?

n  Many variations

n  Basic ideas: n two people working on one piece of code n continual communication between the two

programmers n only one person is editing the code at any

time

+Pair programming

n  Driver: n  person currently working on the code

n  Observer: n  watches the person coding n  looks for errors n  should be thinking higher-level about where

to go next, issues, etc.

n  Switch rolls frequently and regularly (e.g. every 5-10 min)

+This Is Pair Programming

+ Pair Programming Has Been Around For a LONG TIME!

. . . 1945 1953 … 1997 1998 1999 2000 2001 2002

John von Neumann, recognized his own inadequacies and continuously asked others to review his work.

Fred Brooks and many others are pair programming, though they don’t know there is a name for it.

Page 3: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+Pair programming

Benefits?

Drawbacks?

+Does Pair Programming Really Work?

It depends…

+Does Pair Programming Really Work?

n  Many different studies (Wikipedia cites some, but others exist)

n  Empirical study by Laurie Williams at the University of Utah (now at UNC) n  Solo vs. pair: Fall 1999

n  41 students (junior/senior) n  28 worked collaboratively

n  13 worked individually n  Software development process was controlled

n  The only experimental variable: pair-programming n  Quantitative: time, quality, enjoyment, confidence

+ Findings #1 - Quality

Post Development Test Cases Passed

0.0%10.0%20.0%30.0%40.0%50.0%60.0%70.0%80.0%90.0%

100.0%

Program 1 Program 2 Program 3 Program 4

IndividualsCollaborators

Page 4: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+ Findings #2 - Time

Elapsed Time

0.0%

20.0%

40.0%

60.0%

80.0%

100.0%

120.0%

Program 1 Program 2 Program 3

One Individual One Collaborator

+ Findings #3 and #4 – Enjoyment and Confidence

Enjoy the Work More Because of Pair Programming

0%

20%

40%

60%

80%

100%

PROF SUM1 SUM2 SUM3 FALL1 FALL2 FALL3

Agree Disagree

More Confident in our Work When Pair-Programming

0%

20%

40%

60%

80%

100%

PROF SUM1 SUM2 SUM3 FALL1 FALL2 FALL3

Agree Disagree

+Why does it work? n  Pair-Pressure

n  Keep each other on task and focused

n  Don’t want to let partner down

n  “Embarrassed” not to follow the prescribed process

n  Parkinson’s law: “work expands to fill all available time.”

+Why does it work? n  Pair-Think

n  Distributed cognition: “searching through larger spaces of alternatives” n  Have shared goals and plans

n  Bring different prior experiences to the task

n  Different access to task relevant information

n  Must negotiate a common shared of action

Page 5: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+Why does it work?

n  Pair-Relaying n  Each, in turn, contributes to the best of their

knowledge and ability

n  Then, sit back and think while their partner fights on

+Other Research Findings

n Strong anecdotal evidence from industry n “We can produce near defect-free code in less than half the

time.”

n Empirical study n  Pairs produced higher quality code

n  15% less defects (difference statistically significant)

n  Observed – pairs produced smaller (LOC) programs

n  Pairs completed their tasks in about half the time n  58% of elapsed time (difference NOT statistically significant)

n  Most programmers reluctantly embark on pair programming n  Pairs enjoy their work more (92%)

n  Pairs feel more confident in their work products (96%)

+Other Research Inquiries

n  Other questions: n  What about pair learning?

n  Anecdotally people say that it works well

n  What are the long-term issues? n  If you learn as a pair, can you work as a solo?

n  Can pair programming be done remotely?

+Issues: Partner Picking Principles

How do you pick pairs? What are some things to watch out for?

Page 6: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+Issues: Partner Picking Principles

Expert paired with an Expert Expert paired with a Novice

Novices paired together Professional Driver Problem Culture

+Configurations

Most common: sitting next to each other

+Configurations

Face-to-face with own screen and own keyboard/mouse but using a shared editor -  allows for face-to-face conversation -  some feel more natural and productive

+Configurations

Remotely using a shared editor

Page 7: Pair Programming - Pomona · 2012-04-10 · Pair programming ! Driver: ! person currently working on the code ! Observer: ! watches the person coding ! looks for errors ! should be

+Expected Benefits of Pair Programming

n  Higher product quality

n  Improved cycle time

n  Enhanced learning

n  Pair rotation n  Ease staff training and transition

n  Knowledge management/reduced product risk

n  Enhanced team building

n  Increased programmer satisfaction

+Some concerns

n  There are some barriers to entry n office configurations n people are resistant n holds people accountable n http://blog.obiefernandez.com/content/

2009/09/10-reasons-pair-programming-is-not-for-the-masses.html

n  not faster in all situations n you are devoting two people to a task n some tasks are very straightforward and may

only require one person

+ +Pair programming applied

n  Implement binary search in ruby n  two parameters:

n  a single sorted list n  a value to search for in that list

n  returns n  nil if it does not occur in the list n  the index if it does occur (any index if it occurs multiple times)

n  Pair program n  switch every 3 minutes

n  Two approaches n  recursively:

n  use a helper function n  pass a start and end index where you are still searching

n  iterative: n  keep track of the start and end index where you are still search