28 January 2010

Pair programming is great but tiring

Introduction

Pair programming offers lots of advantages such as better quality of code (constant reviewing), less code (constant refactoring) and better communication within the team (knowledge transfer). Because you are always focusing to either comment on the code that the driver is writing or either write code while listening to your peer, you quickly get tired.

Workspace setup

To limit this effect, a good thing is to setup the workspace so that you can both work comfortably on the same machine. Some of my colleagues like to have a laptop they can use while the other drives so they can quickly search for documentation or articles related to the area they are working on.

Learn from each other

I think that pair programming is more tiring if you are working with someone with more experience than you, because you have to make an effort to not make too many mistakes. If you were on your own you could just try things. With pair programming, you could still do it but only if your peer doesn't have a direct solution to the problem.

You can learn so many diverse things when pair programming. I sometimes work with more senior developers and, of course, I learn good practices and stuff, but not only. Something as simple as setting up your IDE properly can greatly increase you productivity. Pressing a keyboard button (to run all tests in current context or clean unused using or import statements in a file) or a sequence of buttons (comment, uncomment a piece of code or open a specific window) is far quicker than right clicking somewhere then selecting an item in a menu. If you pair program with someone that has much more experience than you, you are forced to try to work at the same speed. You also have to concentrate at all time to pick up anything you can. It is very tiring but you learn so much :)

Anger Management

Another thing that you need to have if you don't want to end up fighting with your peer is diplomacy and humility. You have to be prepared to accept criticism. Not all the time of course we all have bad days especially on Mondays. Taking a 5 minutes break helps a lot sometimes.

Time Management

Based on the Pomodoro technique, our team found good ways to make pair programming less tiring. By working for 25 minutes, taking a break of 5 minutes then swapping the keyboard/mouse for another 25 minutes and so forth, you can work the same way for weeks. We more often do 25 minutes each then 10 minutes break but I believe it is because we know each other habits and are used to them so we can hold a bit longer :) You could still work for hours by passing the keyboard/mouse every 25 minutes but you would both look like zombies after few weeks. Life is too short.

Conclusion

The use of Pair Programming combined with other good practices is pretty much bound to your boss understanding that great developers write great code. And if that code is well utilised, it can make a business successful.

No comments:

Post a Comment