There are several things that will make your pair programming sessions work better. Things you can actively do and others best to avoid.
First of all, you need to give it an honest shot, especially if you’re not experienced in pairing. Pair programming is a skill and needs to be learned. Like learning any other thing the process can be tough, it can take you out of your comfort zone and get your mind resisting and wanting to do things as usual. So it’s important to be open about the experience and try to make the best of it.
Communication is crucial, you need to talk to your partner and learn to listen. There is a quote by Donald Knuth which I really like that says: “Programming is the art of telling another human being what one wants the computer to do”. This has always stuck with me since I first read it and when you’re pairing it applies even more. That’s the essence of it.
Effective listening is necessary, listening to others is by no means easy! Try to open to their suggestions and be aware of the interaction you have with your partner. Don’t rush through the task, take the time so both understand clearly the goal.
You need to be patient, you may have a very clear idea but your partner may not understand so try to explain things and help them understand. Use a notebook or a drawing board, don’t get frustrated if you need to repeat things many times. At the same time sometimes you just need to trust your partner. You may not understand clearly despite their best intentions or may not exactly agree on how to do things but let them show you their way. If after all the idea doesn’t work out you’ll both get something out of it, and the next attempt will work out much better as you won’t have to make the same mistakes.
Code written by a pair is a construction of the best ideas by two people and coming up with them, things need to be challenged. You’ll need to convince your partner and in some occasions you’ll need to convince yourself, so it’s important to leave the old ego at home! It’s not a competition nor is it about being right or wrong so questioning and discussing are vital and need not be taken personally. Remember the deliberation is all about the ideas not the people.
Be respectful when talking, try to avoid using bad words and expressions, try to keep the session positive even when faced with challenges (bugs, bad documentation, some third party failing, etc). Stay positive! A good mood will help the sessions be lighter and less stressful for both. And it’s ok to keep your partner in check, if they are being cranky or moody let them know and help them cheer up.
Taking regular breaks is also advisable. When you’re pairing a lot of the little distractions that plague us will vanish. Writing emails, checking slack, reading blogs, twitter, news sites, etc is not something you can do with someone next to you so the increased focus will be draining after a while. When you feel tired go for a coffee or go for a walk, try to change the environment so that you can recharge and get back into action feeling fresh.
Last but not least, you’ll be working shoulder to shoulder with someone so consider your personal hygiene and avoid using too much perfume or after shave as some people may be sensitive to it.
This is not an exhaustive list but by using these points you’ll see how your pair programming sessions become more enjoyable and after practicing some time you’ll get acquainted and see how working in this way is worth it.