Using the Socratic Method in Pair Programming

I had a mentor once who was a delight to work with. He was fun and smart and brought great, enthusiastic energy to pairing. But he also approached the collaboration in a way that I had never experienced before, using the Socratic method in pair programming.

As part of Atomic Object’s Accelerator Program, I was at the time a junior developer with a lot to learn. Whenever we paired on something that I was less confident about, he would ask me a lot of questions as we worked. At the time, I assumed he was just double-checking my logic, making sure that I wasn’t about to derail our workday with a rookie mistake.

“Why are you giving this variable that name?”
“Should this class have this responsibility, or should we make a new class?”
“Where do you think we should start with this story?”

But after a few months of working together, I worked up the courage to ask him why he second-guessed me so much. After all, if there’s something he thought I was missing, he could just tell me. I wouldn’t be offended.

His response changed the way I viewed the way experienced developers can best approach pairing with a junior developer. “Oh, I’m not second-guessing you!” He assured me. “I’m using the Socratic method. I’m helping you learn!”

What is the Socratic method?

According to Wikipedia, the Socratic method “is a form of cooperative argumentative dialogue between individuals based on asking and answering questions to stimulate critical thinking and to draw out ideas and underlying presuppositions.” In other words, it’s a way of approaching a conversation with a series of questions in order to suss out the unconscious thinking behind thoughts and ideas.

I know, it definitely sounds like a philosophical concept. It’s one that has no place in software development, right? That’s what I thought when this mentor first explained it. But over time, I’ve realized just how much value the Socratic method can bring to pairing and mentorship.

How did I experience it as a junior developer?

After this mentor explained to me the purpose behind his questions, I immediately approached those questions differently. Now when asked why I named a variable something, I didn’t worry that there was a mistake in the naming. My mentor was giving me the opportunity to examine my own thought process behind choosing that name. It became something like a mindfulness exercise, helping us both learn more about not only what we were doing, but also why.

These questions helped me build the muscle of taking a step back to examine what I’m doing and why I’m doing it. Often, these pauses provided us the opportunity for growth. It gave me time to realize I didn’t understand a concept or convention and ask for an explanation, or else it would let us both step back and think of alternative solutions. This is a skill I still leverage to this day in my development work.

How do I leverage it as the more experienced developer in a pair?

I’m no longer an Accelerator at Atomic. I’m now a developer with a few years of development and consulting experience under my belt. So I now find myself on the opposite side of the pairing session: I’m the senior developer working with a junior developer in the Accelerator. In those pairing sessions, my goals are to help a junior developer grow while also writing good code and providing value for our clients. I’ve been surprised by how often I find myself reaching for the Socratic method.

It’s not something I use all the time. I know from experience that it can be frustrating to be a junior developer trying to have my pair seemingly do nothing but ask questions. But when I spot the opportunity to slow down and take a moment to learn, I try to do so.

“Is this the best place to add this functionality?”
“Does this fall within the scope of our current story?”
“Are there any other edge cases we could be testing for?”

Just like my own mentor, I am not seeking to undermine my pair. My goal is to help them examine their own thinking, grow that self-reflection muscle, and make these questions a habit. I want to help them grow in their own self-confidence, just like my mentor helped me.

The Socratic method is a valuable tool for pair programming.

The Socratic method is not just a tool for philosophic debate. It’s a valuable technique for a pair of programmers to have in their toolbox. When utilized effectively, this method can build both developers’ confidence in their own individual skills and also in the decisions they make together as a pair.