POST DIRECTORY
Category apprenticeships

The first time I was asked to mentor a junior programmer while pairing, I was intimidated by the combined pressure to deliver quality software for our client and also earn respect as a mentor from my student. I wanted to be able to provide all the answers and protect my pupil from making the same mistakes that I made as a junior, but of course, it’s difficult to learn if someone else is doing all the driving. And how to ensure that the deliverables don’t suffer for the time spent on teaching?

Tips on Successful Pair Programming Mentorship

In this article, I’d like to offer several suggestions for ways you can work together with your pair to avoid knowledge force-feeding, keep pace with your pair, and maintain high coding standards. Whether this is your first time mentoring, or you’ve been coaching devs for years, the following practices can help:

  • Start small – Choose tasks that are right-sized to challenge your student without jeopardizing your chances of success.

  • Ask questions – Try to understand your pupil’s current level of understanding by asking questions. Your soft skills will be much more important in this endeavor compared to your typical day at the terminal — you’ll need to listen carefully, and practice offering tactful, concise feedback to make corrections about what your pupil is saying and typing. Rather than reciting the pros and cons of a particular implementation, try asking “What are some of the trade-offs of this approach?” and listen for signs that your student truly understands the code’s limitations and implications.

  • Take turns – I’m a big fan of ping-pong pairing as a mechanism to share responsibility and give both members of a pair the chance to test and implement. When you’re practicing ping-pong style pairing, you’ll write a test, your pair will implement to make the test pass, then you’ll switch roles so your pair writes the next test. I find this practice helps with learning the business domain and results in code that converges on the best style from both pairs.

  • Sit on your hands – No, seriously! When it’s your pair’s turn to drive, put your hands between you and your chair. Limiting how often you’re controlling the keyboard will force you to talk through the problem and allow your student to get comfortable in the driver’s seat. When your pair asks for help and a verbal suggestion isn’t enough to get them unstuck, of course, you can always jump in to demonstrate, but the intentional physical impediment will prevent you from hogging the keyboard.

  • Read body language – If you’re working remotely, it helps to have video enabled to watch for body language cues, even if your focus is on the code. Your pair might not be comfortable admitting they are confused or getting tired, so if you are on video you can get these cues non-verbally. Pairing can be surprisingly exhausting, especially if you’re not accustomed to it. If you notice successive yawns, folded arms, or other signs of distraction, don’t hesitate to check in on energy-level and ask about understanding. Sometimes we just need a break.

  • Assign homework – Sometimes, you might underestimate how long a task will take. Defer some tasks and / or provide resources where the student can level-up on their own time. This will allow you to carry on with the work and allow your student time for self-guided work. Encourage pull requests or a follow-up gist to allow for asynchronous conversation to occur.

Iteration as a Fractal

When you’re developing software on your own, you probably don’t expect to get every test and line of code exactly right the first time. Some of our best solutions come through various methods of exploring a problem domain, so an effective mentor-pair will allow for this exploration to occur.

While pairing, I try to remind myself to exercise extra iterations on every task. I would typically want ample time to apply these best practices anyway, but when acting as a mentor, double down on these techniques to ensure plenty of opportunity for scrutiny and cross-pollination:

  • Before writing code, discuss the task’s requirements from different perspectives: in detail, in summary, and at the edges.
  • Use and explain practices like red-green-refactor to write and rewrite your tests and implementation.
  • Take time to exercise the solution on different devices and browsers, and don’t only simulate happy-path use cases; bad-actors, search engines and screen readers will each interact with your app in different ways.
  • When you’re satisfied with the work, write and rewrite your commit messages and work together to craft pull request descriptions that have plenty of context for other developers and stakeholders.
  • Schedule time to conduct regular retrospectives on your student’s progress, and to open yourself up for feedback on becoming a better mentor.

When you’re not pairing in real time, submit pull requests for your pupil to review, and don’t be ashamed to show the messy steps in between that brought you to the final commit. Solicit feedback from your pair, and allow yourself ample time to draft extra commit messages that explain the choices you made along the way. If applicable, offer feedback on your pupil’s feedback (“meta-feedback”?).

Stay Studious

Even though you’ve been asked to mentor, remember to keep a student’s curiosity and humility close at hand. The very nature of knowledge and experience is that they can only be limited. Ignorance will always be boundless. Embracing this will help you remain in the student mindset and increase your ability to empathize with your clients and pairs. Your student will likely have experiences that you can learn from, so keep asking questions!

To keep your skills sharp, look for programming-centric meetups in your area, or find some colleagues where you work who are at different experience levels, or who have familiarity with languages or frameworks different than your own. Take turns teaching each other something or helping each other with tricky coding problems. If you’re bound by a non-disclosure agreement, find a code kata to pair on, or head over to exercism.io to tackle a coding challenge together. If the programmer population density in your area is lacking, services like codementor can help you find (or become) a mentor online.

What else?

What questions do you find particularly useful when pairing, either as a student or as a mentor? Are there crucial mentorship mechanisms I left out? Comment on our social channels at Twitter or Facebook.

''