🤝 Prepare for and ace a pair programming interview
A pair programming interview can feel more intimidating than a take-home test or having an interviewer ask you technical questions. This is perfectly normal: Coding in front of someone can be uncomfortable, especially when there are high stakes.
For employers, a pair programming interview is useful to assess how well you would work within the team. It replicates the space you would be hired into more accurately.
For you, it’s a great way to showcase your problem-solving and technical abilities, how you think, as well as your communication and collaboration skills. It’s also an opportunity to explore what it would be like to work in a particular team, and it may give you some insight into the work you’ll be doing in the role.
What a pair programming interview entails
Pair programming involves two or more people writing code together to build a solution.
Approaches to pair programming
There are a few different approaches employers adopt in these interviews:
The “driver-navigator” approach
The driver, or the interviewee, writes code based on the navigator’s, or the interviewer, specifications. The driver can ask the navigator questions and offer alternative solutions to the navigator’s, but the navigator has the final say on the solution.
Basically, the driver writes the code and the navigator dictates the direction of the code.
“Ping-pong” programming
In “ping-pong” programming, the interviewer and interviewee take turns writing code and tests for a solution. One person writes a test and the other passes the code through it, and then they switch. It’s a combination of Test Driven Development (TDD) and pair programming.
Benefits of pair programming
No matter the approach, the idea behind these kinds of interviews remain the same:
Two brains are better than one
Two people working on a solution together makes higher quality code more likely than only having one person doing the work. It also speeds up the process to creating a solution.
Spreads knowledge
Pair programming allows for a space in which people can bounce ideas off of and learn from each other. Learnings are not only restricted to problem-solving processes, but it also includes technical knowledge and coding best practices.
It may even encourage individuals to think more deeply and creatively when they need to explain their thoughts to another person.
Having two or more programmers fully understand a solution makes spreading the knowledge across the team easier. This helps grow, refactor or rebuild the solution in future if needed.
Common problems to solve in a pair programming interview
The actual interview and what kind of problem is presented will depend on the employer you’re interviewing with. Below are some common challenges you might need to tackle as part of the interview:
- Set up a development environment and builds a sample feature.
- Work with an existing employee in building a sample feature on the employer’s codebase.
- Choose a task and code while talking to the partner about their understanding of the challenge.
- Solve a challenge alongside the partner.
- Find and solve a bug presented to them in a given codebase.
How to prepare for a pair programming interview
Besides helping you ace the pair programming interview, preparing will also help calm your nerves and make it seem less intimidating when the interview comes up.
Have the correct set-up
If the interview is being run remotely, make sure you have the correct software for video chat and sharing your screen, such as Zoom or Google Meet.
Ensure you have the relevant coding software set up, including a code editor, IDE, any required plugins and if there’s an existing codebase you’ll work on in the interview. If you’re unsure, ask the hiring manager for what you need to specifically set up when you’re scheduling the interview.
Practice coding under similar conditions
Practice working with the programming language and tools you’ll be required to use in the interview. Solve a problem using the same tools and brush up on anything you’re unsure of. You can find challenges through websites like Leetcode or Codewars.
Ensure you’re also practising coding best practices, like writing clean code and relevant tests.
If it’s possible, code alongside a friend or family member. Practising the ‘pair’ element will help make it less intimidating in the interview.
Ask questions ahead of the interview
If you’re unsure of anything, ask the hiring manager well in advance of the interview.
It could be that you don’t know exactly what software you’ll need to have set up, what programming languages and tools you’ll need to use, or even that you’re unsure what to prepare.
Whatever it is, rather get this clarity at least three days before the interview. It’ll show the hiring manager that you’re committed to the process and eager to engage with this particular stage.
It will also give you time to set up unfamiliar tools and troubleshoot any issues with your existing ones. For example, asking what IDE you’ll need means you can get the correct one (if you don’t already have it) and you’ll have time to get familiar with it.
What to remember during the interview
It’s totally normal to feel nervous just before and during the interview. You’ll likely find that as you go through the interview itself, you get more and more relaxed. Remember that this is just a space in which the interviewer is getting to know how you work.
Try to be yourself as much as possible, and code as if you were approaching the problem in your current job or on a personal project.
State your understanding of the problem
When the problem is first presented, repeat back to the interview what you understand the challenge to be. This helps clarify if you’ve correctly understood what you’re being asked to do.
The interviewer can confirm if you’re correct or not, and they can offer you more information, which already initiates collaboration. Considering they will be assessing your collaboration skills and what it’s like to work with you, this is a great way to begin solving the problem.
Once you’ve started working with your interview partner on the solution, it’s likely you’ll come across another complexity you need clarification on. These moments are also great opportunities to state what you know: Repeat back to the interview what your current solution accomplishes and what challenges you still need to solve. This strategy does three things:
- It demonstrates your understanding of your code and the challenge.
- It allows you to take a step back and see the problem more clearly, which can make the solution more apparent.
- It provides your interview partner with an opportunity to offer their ideas and solutions, furthering collaboration.
It’s seldom you’ll work on a coding challenge alone in a professional environment. Hiring managers want to see how you work in a team setting. Stating what you know gives you plenty of opportunities to showcase your skills around this.
Ask questions to gain a better understanding of the problem
Stating what you know goes hand-in-hand with asking questions. After you’ve shown the interviewer what you understand, you can follow up with questions about parts that you don’t. It gives them insight into your coding, collaboration and problem-solving skills.
Some questions you may want to ask:
- Could you give me an example of how a user may interact with this feature we’re building?
- Could you clarify what you meant by that particular statement?
- Do you have any preference for how we begin solving the problem?
A pair programming interview is not about catching you out on what you don’t know. The interviewer wants to understand what you do know. By asking questions, you’re giving them easy access to this information.
Don’t worry if you need to take a minute or two to think about what questions you want to ask. Having a moment of silence may feel uncomfortable initially, but you can let the interviewer know that you need some time to think to relieve any awkwardness. It also shows you’re capable of communicating your thoughts clearly in acknowledging their presence.
Break down the problem
It can feel overwhelming when you face a complex challenge. You need to resist the urge to dive in and build a solution you think addresses all the requirements of the challenge.
Rather start by simplifying the problem you’re given to solve. Break the problem down into the smallest possible elements and start with the most simple scenario. This gives you somewhere to begin, allowing you to start working with your interview partner.
It also gives you a deeper understanding of the challenge, which helps you expand your initial solution and solve the larger problem. If you can break the problem down into its simplest form, it’s likely that you fully understand the challenge.
This approach is also helpful if you have a set amount of time to complete the challenge. It will allow you to create an initial solution within the allotted time, which you can then expand on if you have time left over.
Write tests and clean code throughout the interview
You may not be able to write tests in every pair programming interview. But whenever it’s possible, it’s important to write tests for your code:
- Testing allows you to think through different possible scenarios that your solution should address.
- Testing can be overlooked in an interview setting, but it's an easy way to make sure that your code behaves as you expect it to.
- It showcases your commitment to coding best practices.
When you’ve completed your solution, fully explain how you got to your solution. Often giving the interviewer visibility on this process is more important than the solution itself.
Download prep for pair programming interviews.