Pair programming can be tough for even the best developers. It can be downright daunting if you haven’t done it before, are introverted or unsure of yourself. For those of you who want to improve your pair programming abilities, the following seven secrets are helpful strategies in accomplishing that objective. They are distilled from my 10 years experience pairing as a developer, technical lead, test driven development mentor and Agile coach.
Pair Programming Secret #1. Proficiency
Proficiency with the language and proficiency with the IDE are paramount to working as an effective pair partner. When you program with a pair partner you have nowhere to hide. All of your skills and abilities, along with your fears and shortcomings, will be on display for the team to see. To overcome these challenges, you must first accept that there will always be someone out there who knows more than you do.
Secondly, you should work to improve yourself in the places where you feel weak or unsure. Try spending 30 to 60 minutes per day, for a couple of weeks, on self-improvement in the areas you are worried about. You’ll be surprised by the results.
Finally, you must master your IDE. Almost all modern IDEs have a wide range of shortcut keys for the most commonly used actions and commands. Find a reference card for your IDE on the Internet and highlight the ones you think will be most useful to you. Then memorize the shortcuts and start using them every day. Your pair partner will appreciate your mastery of the IDE and you will improve your efficiency.
Pair Programming Secret #2. Communication
In any relationship, communication is key. Pairing is a very intense, albeit short relationship between two people working collaboratively towards a shared goal. Before you dive in to writing code, spend a few minutes discussing the task and identifying an approach to implement a solution. Doing so will ensure that you and your pair partner agree on what to do and how to do it.
When it’s your turn at the keyboard, keep your pair partner informed. You need to verbalize your thought process to let your pair partner know where you are heading and why. Try to articulate what you are doing and ask your pair partner questions to help keep him or her involved and engaged. For instance, after passing a test, I will often say, “What do you think?” and offer the keyboard. This is a chance for my pair partner to improve, refactor or write another failing test.
Pair Programming Secret #3. Self Confidence
When you are confident in yourself and your abilities, you feel comfortable offering and receiving constructive criticism. Self awareness of your strengths and weaknesses, coupled with a confidence that you “can do this” allows you to relax and focus on your work rather than on your shortcomings. Additionally, you will be able to open yourself up to constructive criticism and you will have the perspective necessary to determine if the criticism is relevant and actionable.
With self confidence, you will find that you are more willingly to ask questions and try out new ideas. Your self confidence can inspire better communication on the team by setting the example that you are willing to admit that you don’t know everything and are willing to ask for and accept help. When you’re self confident you don’t worry about what others are thinking about you or about your productivity, so you are more willing to take chances and try innovative solutions.
Pair Programming Secret #4. Self Control
The discipline of software development requires a significant amount of mental effort and focus. It’s easy to have self-control lapses when we are bored, tired or frustrated. Anything that distracts your attention can be a potential productivity killer.
The high-functioning teams that I have witnessed leverage their “team norms” or “ground rules” to help reduce the number of potential distractions. You can also leverage good Agile principles to stay focused. Use spikes to investigate new ideas and techniques. Add a “time allowance” to your spike story to keep from going down an endless “rabbit hole.” These are key because when you’re working on an Agile team you’re responsible not just for yourself, but for everyone else on the team. That’s what we mean by the “whole team approach.”
If you’re having trouble focusing, you should be able to rely on your pair partner and your team to help get you back on task. Just the same, if you notice that someone else is having a hard time staying focused, you need to be willing to step up and help them get back on track. Remember, you will succeed or fail as a team.
Pair Programming Secret #5. Patience
We have clearly established that writing code with a pair partner is very different from hacking alone all day. Your patience, or lack thereof, doesn’t usually affect others when you’re working alone. If you’ve spent your whole career as a solo “keyboard jockey,” pair programming will put your patience to the test.
As a pair partner you won’t always have control of the keyboard and mouse, and it is considered bad form to rip the mouse out of your partner’s hands. So when you get the urge to grab, take a deep breath, exercise your self control, and then use your best manners to ask, “May I?”
Once you get control of the keyboard and mouse, you should be willing to relinquish it without a fight. Liberal keyboard passing helps keep both pair partners engaged and motivated. Some of the best athletes in team sports are the ones willing to sacrifice a small personal victory and make a pass to a teammate in order to achieve a larger team “goal.”
Pair Programming Secret #6. Manners
Manners in the workplace seem to have gone the way of chivalry, yet good etiquette is a crucial part of human interaction. Programmers often forget this because they don’t have to thank their shell script for searching through a log file, nor do they have to ask their laptop to politely launch their favorite IDE. However, when pairing, good manners are expected and poor manners are not easily forgiven.
I find it useful to start off a new pairing session by setting a few simple ground rules. If you prefer to formalize these ground rules you can work with your team to create a set of team ground rules for pairing. Whichever way you go, just remember that it is necessary to have a shared understanding of how you will work together as a pair before starting, to avoid confusion and hurt feelings. You might be surprised to learn the actions that distract or bother your co-workers.
By working to improve your manners I think you will find that you will have more enjoyable pairing sessions and will become one of the most sought after people to pair with on the team.
Pair Programming Secret #7. Hygiene
This should really go without saying. Unfortunately, I have to say it because too many people ignore the use of basic hygiene in the office. It’s better that you hear it in the context of an article than suffer the embarrassment that poor hygiene could cause later. So consider this a quick “Health Class for Pair Programmers.”
Of course, you should shower every morning, brush your teeth and use deodorant. Throughout the day you need to be mindful of your breath and consider brushing, following up snacks and meals with a mint or breath freshening gum. If you smoke, you should always wash your hands and freshen your breath before returning to your workspace. If you cough or sneeze, be sure to cover your mouth using the inside of your elbow as a shield and sound muffler. Always keep hand sanitizer nearby to keep your hands clean and sanitary throughout the day.
In addition, if you work in a bullpen or Agile room, it’s important to remember to clean up after yourself. It’s not fair to the pair that will come behind you to have to clean up before they can start working.
Toward Pair Programming Perfection
Hopefully, you will find these seven secrets helpful for your next pairing session. I have probably violated every principle of every secret in this article and this is part of what has made it possible for me to compile these secrets. But thanks to my years of experience and with help from my teammates and coaches, I have gained a level of self awareness that now allows me to make the necessary adjustments to become a more effective pair programmer in the workplace.
By no means have I completed this journey, but I am a better pair programmer today than I was yesterday. It is for this reason that I define success, not as the attainment of a static goal, but rather as the continual attainment of small goals on a path toward perfection, and with the full awareness that my journey as a pair programmer will end well before achieving perfection.
Did I leave out any important traits for successful pair programming? If so, tell me about them in the comments below.
Further Reading on Pair Programming
If you’d like to read a bit more about this subject, check out these links