Maybe your new to programming or new to pairing, in this post I want to provide some helpful tips to help you get the most out of pairing.
Always share the wheel Pair programming is a team process. If you spend most of the time driving the keyboard and mouse then you might as well not be pairing at all. I find it helpful to plug an extra keyboard and trackpad into my laptop and hook up a second monitor. This gives my pair the same advantages that I have. They can see the full screen and have the same ability to type and move around that I do.
It's not a competition You aren't fighting for who has the best line of code. Let the thought process take over and you can always go back and cleanup after you have the core foundation created. While one person is driving the keyboard and mouse it's the other person's job to help provide suggestions to further improve or solve an issue. Don't try and hold in your thoughts until it's your turn to take over.
Don't be afraid to pair with a new developer One of the main concerns you might have is what is a junior or even a new developer going to teach you. There are many things that you can gain from pairing with an inexperienced developer. A new developer has a fresh mind and can provide another way of approaching a task that you may have not thought about. While a junior developer will have the drive to question the reasons behind what you are doing and maybe help to properly think through the task. Let's not forget that you are also providing essential feedback to the growing community of developers and helping to shape the future.
Take time to explain your code Nothing is worse than just staring at someone typing and not hearing any feedback as to what they are creating. Try and take the time to explain the code as you type it. Why did you decide to use a
forEach instead of a
map on the array you are looping through? Why are you creating a
Class instead of just writing out a
function. Even the smallest details can help the other person understand what you are typing and in turn getting to know their process can help create a more inviting pairing routine.
Rinse and Repeat You will not learn everything in a day. Try and find time either weekly or every other week to just sit down for a few hours with someone. Even after a long day at work, it's nice to sit down and talk to another developer about my thoughts for the day and what I have learned.
Make it a social experience You don't always have to jump directly into coding. Sometimes the best pairing experience is just two developers talking about technology news and going over new things that they have used or have heard about. Showing examples of projects and getting feedback can be just a valuable.
In closing, pair programming is a side hobby that I have found to help me branch out and learn from local developers in my community. I strongly suggest going for it if you can fit it into your schedule.