Today at work we tried mob refactoring, which is just like mob programming, but instead of creating new code you refactor existing code. Our goal was mostly to spread knowledge within the group, to even out the knowledge a bit and also practise refactoring. We are lucky enough to have a projector in our room so we fired it up and started.

The thing we wanted to refactor was one of our most central classes, which has almost 300 lines of code. We decided that the most experienced refactorer would not be writing any code, he would only be a navigator, the rest of us would both drive and navigate and we changed driver every 10 minutes. We did this for about an hour.

Results (some of them just from my point of view)

All the drivers felt really stupid behind the keyboard, we stumbled on the keys and at times at least I felt like I had no idea what to do, or where to do it. However I really liked being just a stupid input device and getting to concentrate on just writing what I was told to.

The decision to let the less experienced drive resulted in the code being written slower. That in turn gave us all a possibility to read and contemplate the code and what to do next. I have found that when a more experienced person drives there is a risk they already know exactly what to do and have done it before the lesser experienced has had the time to really grasp the problem.

Another good thing that came out of the mob refactoring session was the friendly, constructive discussion. We shared tips and tricks about the editor, about the code and how to make it better. Some of these tips are things someone could do in a short period of time as a preparation for a future refactoring.

At the retro we held afterward, everyone really liked the mob refactoring and we all wanted to do it again. We decided to do it every Wednesday morning for an hour.

The only thing I found not to be as good was that we had two screens. The big one everyone was looking at, pointing at and commenting, and then the smaller one on the laptop in front of the driver. When being the driver, I sometimes got a bit confused not knowing what the others where talking about in the code since my eyes naturally was drawn to the smaller screen that was closer to me and by doing that I missed where the others where pointing .

All in all it was a great experience and I would love to do more of it.

If you want to read more:
mob refactoring
mob programming