How to Run an Online Pair Programming Session: Driver-Navigator Handoffs

Give the driver and navigator clear jobs, practise deliberate role handoffs, and build one small JavaScript function together in a focused online session.

Author profile photo

By

Share this article:TwitterLinkedIn

Illustration of two learners discussing a coding plan from separate desks with arrows suggesting a change of roles

Two people can sit through an online coding session while only one makes decisions. Before opening the editor, agree on how each partner will contribute and what they will say when they change roles.

This session gives beginner programmers one small implementation task and several explicit handoffs. The aim is for both partners to explain the work and take a turn writing it. Focus Room can set website rules around the browser work period; your existing coding and meeting tools provide the shared workspace and conversation.

Make the two roles concrete

The Agile Alliance pair-programming glossary describes a driver at the keyboard and an actively involved navigator considering overall direction, with regular role swaps. It also identifies passive participation as a pitfall. For an online lesson, adapt that arrangement to your shared editor or agreed screen-sharing setup.

Give each partner a short role card:

  • Driver: Explain the next change, type it, and run the agreed example. Pause when the navigator asks a question.
  • Navigator: Keep the requirement visible, predict the next result, and ask whether the proposed step fits the plan. Leave typing to the driver.

Both partners may suggest ideas. The role cards assign a current responsibility, not ownership of the solution. Agree that control changes only after a spoken handoff; reaching into someone else's editor mid-sentence makes the transition harder to follow.

Start with one contract and a working route

Use a clean file and this fictional exercise: implement formatDuration(totalSeconds) in JavaScript. For this lesson, inputs are non-negative safe integers. Return a string in H:MM:SS form: hours may have more than one digit, while minutes and seconds always have two. Invalid-input handling is outside the task.

Keep these examples beside the contract:

  • 0 produces "0:00:00".
  • 65 produces "0:01:05".
  • 3661 produces "1:01:01".

Ask each partner to explain one example before coding. In particular, 65 means one minute and five seconds, not sixty-five minutes.

Check that both can see the same current file and run JavaScript in the selected environment. Rehearse changing edit control. A call plus screen sharing may work, but it needs an agreed way for the other person to take over. Account access and editor collaboration permissions belong to those tools.

Conceptual illustration of a learner relating a paper coding contract to clock and input-output cards

Work in small slices before swapping

For a suggested forty-minute session, allow five minutes for the contract and access check, ten for decomposition and the first implementation slice, ten after the first handoff, ten for examples with another role change, and five for explanation. Adjust the pace to the learners; these timings are a facilitation choice.

Start with an empty function body. The navigator proposes the quantities to calculate: complete hours, complete minutes remaining after the hours, and leftover seconds. The driver repeats that plan before typing.

For the first slice, calculate hours and seconds. With 3661 seconds, there is one complete hour and one leftover second. Ask the navigator to predict both intermediate values. This gives the first driver something concrete to explain at the checkpoint.

Then pause. A useful handoff might be: “We have the hours and seconds calculations. Minutes still need to exclude complete hours. Next, calculate minutes and format the result.” The incoming driver repeats the next step before taking control. Keep the file open so they can connect the explanation to the current state.

Finish the function with both voices involved

After the first swap, the new driver calculates minutes within the current hour. For 3661, dividing by sixty and rounding down gives 61 total minutes; taking the remainder after division by sixty leaves one minute. Explain the distinction before adding string formatting.

The navigator asks what should happen when minutes or seconds are below ten. Convert each to a string and use padStart(2, "0"). Hours remain unpadded.

Here is a complete reference implementation to reveal after the pair has attempted the task:

function formatDuration(totalSeconds) {
  const hours = Math.floor(totalSeconds / 3600);
  const minutes = Math.floor(totalSeconds / 60) % 60;
  const seconds = totalSeconds % 60;
  const mm = String(minutes).padStart(2, "0");
  const ss = String(seconds).padStart(2, "0");
  return `${hours}:${mm}:${ss}`;
}

Keep the reference separate from the starting file. If learners can only copy the finished code, the facilitator loses an opportunity to hear how they choose the next step.

Change roles again for the examples

Before running an example, have the current navigator predict the output. The driver runs it and compares the actual string with the agreed expectation. Swap again so the other partner leads the next check.

Add two boundary prompts: 59 should produce "0:00:59", and 3600 should produce "1:00:00". To check that hours are not a clock that resets after twenty-four, use 90061, which should produce "25:01:01".

These examples check selected behaviours; passing them does not prove general correctness. Ask both partners to explain why minutes stay below sixty and why hours can exceed twenty-four.

Illustration of two learners pausing their laptops to exchange a checkpoint note before changing coding roles

Coach the conversation when a pair stalls

If the navigator dictates every character, ask for the intended outcome of the next step and let the driver propose the expression. If the driver types silently, request one sentence explaining the change before continuing.

When both are unsure, ask them to restate the contract using one input. Offer a smaller prompt if needed. If access or communication creates a barrier, pause and adjust the arrangement rather than treating silence as lack of effort.

Finish with separate explanations: each partner names one decision they made, one question they asked, and the next step they would take. Use those responses to plan further practice.

Prepare Focus Room around the coding tools

Allow the editor, call, documentation, and required sign-in hosts. Test the complete route, including any separate runtime or preview host. The website-rule setup guide covers preparation; the student joining guide explains participation.

Focus Room matches allowed hostnames and their subdomains in the participating browser while the extension session is active. A permitted editor host allows more than one file or project there. Off-list navigation can be redirected and reported; those events do not establish who contributed or understood the code.

Focus Room does not provide a shared editor, assign roles, synchronize cursors, read or run code, execute tests, capture screens or keystrokes, or control other browsers, terminals, devices, or desktop apps. Keep instruction and collaboration in your existing tools. To rehearse the session, create an account, test with a colleague, and end the room when the work finishes.

    How to Run an Online Pair Programming Session: Driver-Navigator Handoffs | Focus Room Blog