Monday, July 05, 2004

How to Teach Refactoring

by Asim Jalis

I was recently pair programming with someone who decided to take some very large steps in the program. It was clear to me that this will quickly lead to uncontrollable complexity. He wanted to move some methods, and modify them at the same time. Problem: How can I convince him to take smaller bites without upsetting him. If I take the keyboard and force small steps in this one case this won't leave a lasting impression. For this to work I must teach him what to do without being condescending. There might be other ways to do this, but one that seems to work reasonably well is the Socratic method. Teach by asking questions instead of giving answers.