top of page

Tutorial 3: AI Pair Programming

  • Contributor
  • 5 days ago
  • 2 min read

Two modes: you drive, AI navigates. Or AI drives, you navigate. Both work. Different strengths.

Step 1: You Drive (10 min)

You write code; AI suggests.

  • Tab-complete (Copilot-style)

  • Side-panel chat for "how do I X?"

  • Quick refactors

You stay in control. AI accelerates.

Best for:

  • Implementing what you already know

  • Working in your strong language

  • Sensitive / security-critical code

Step 2: AI Drives (10 min)

You describe; AI implements.

  • "Add a /api/users endpoint with these fields"

  • "Refactor this to use Promise.all"

  • "Convert this Python to TypeScript"

You review. Approve or push back.

Best for:

  • Boilerplate

  • Unfamiliar libraries

  • Cross-language port

  • Repetitive changes

Step 3: Knowing Which Mode (10 min)

Drive yourself when:

  • You have strong opinions

  • Code is sensitive

  • You're learning

  • Small surgical change

Let AI drive when:

  • Boilerplate-heavy

  • Unfamiliar territory

  • Time pressure on routine work

  • You want to evaluate options fast

Switch within a single session. Both modes coexist.

Step 4: Pair Convo Patterns (10 min)

You: "I need to add caching here."
AI: "Suggested: use Redis with 5-min TTL. Here's the code."
You: "Use in-memory for now."
AI: "Updated. Note: won't survive restarts."
You: "OK. Apply."

Back-and-forth. Iteration. Like real pairing.

Don't accept the first suggestion blindly. Negotiate.

Step 5: Use the AI's Strengths (10 min)

AI is good at:

  • Boilerplate generation

  • Syntax recall (across many languages)

  • Translation between formats

  • Pattern matching on examples

  • Generating tests

  • Refactoring routine code

AI is weak at:

  • Novel architecture

  • Business logic with unwritten constraints

  • Security-critical decisions

  • Anything not represented in training data

Lean into strengths; verify the weaknesses.

Step 6: Talk Through Design (10 min)

I'm designing a payment retry system. Walk me through the
trade-offs of A vs. B.

Use AI as a sounding board. Often you find the answer by articulating the question.

Don't commit to AI's recommendation without independent thought.

Step 7: Watch for Hallucinations (10 min)

AI confidently invents:

  • Library functions that don't exist

  • Wrong API signatures

  • Outdated patterns

Test what AI claims. Especially for newer libraries: trust but verify.

Step 8: Don't Lose Skills (10 min)

Risk: rely on AI; forget the basics.

Counter:

  • Occasionally write from scratch without AI

  • Read code AI generates carefully

  • Understand patterns; don't copy-paste

  • Practice without AI for the fundamentals

You're not pairing with a human. AI doesn't get tired but also doesn't teach you (consistently). You teach you.

Step 9: Time Your AI Use (5 min)

Sometimes:

  • Spend 5 minutes thinking before asking

  • Try one approach before iterating with AI

Otherwise: AI thinks for you. Atrophies.

For deep design: think first; consult AI second.

Step 10: Stay Engaged (10 min)

AI driving + you zoning out = bad output.

Stay in the loop:

  • Read the code as it generates

  • Pause to challenge

  • Ask "why" of suggestions

  • Push back when wrong

Engaged pairing > passive acceptance.

What You Just Did

AI pair programming: drive modes, switching, conversation patterns, strengths/weaknesses, design discussion, hallucinations, skill maintenance, time, engagement. Real pairing.

Common Failure Modes

Always let AI drive. Skills atrophy.

Never let AI drive. Slow on routine work.

Accept hallucinations. Bugs ship.

Zone out during AI generation. Output unreviewed.

No iteration. First suggestion ≠ best.

bottom of page