مرکزی مواد پر جائیں

Chapter 42: The PRIMM-AI+ Framework

"The PRIMM approach recognises that starting with existing code and being able to explain what it does gives novice programmers the confidence to write their own programs. PRIMM begins from reading and explaining code, not from writing it cold." -- Sentance, Waite, and Kallia (2019)

Why This Chapter Exists

James stares at fifty lines of AI-generated Python. Every line works. He understands none of it. His mentor Emma points at line twelve. "What does that line do?" James cannot answer. He has working code and zero knowledge.

AI can write code in seconds. But if you cannot read what it produces, you cannot verify it, debug it, or adapt it. You are not programming. You are copying.

This chapter introduces PRIMM-AI+: the method you will use in every programming chapter from here on. It stands for Predict, Run, Investigate, Modify, Make, with clear rules for when you can use AI and when you cannot. Built on research-tested methods (493 students, 13 schools), PRIMM-AI+ teaches you to read and understand code before you write it. The rhythm is always the same: see a program, predict what it does, run it, investigate how it works, modify it, then build something new. The concepts change. The method never does.

The Five Stages

StageWhat You DoWhat AI Does
PredictRead the code, write your predictionGenerates code, but must not explain it
RunCompare your prediction to the actual outputNot involved: you run the code yourself
InvestigateWrite your own explanation, then ask questionsAnswers your questions after your attempt
ModifyChange the code yourself before asking for helpProvides hints, not solutions
MakeWrite a specification first, then buildReviews your work, but does not write it

You understand before you change, and you change before you create.


Learning Outcomes

By the end of this chapter, you will be able to:

  • Name the five stages of PRIMM and explain why they start with reading, not writing
  • Walk through a complete PRIMM-AI+ lesson cycle with a real Python program
  • State the three rules and five habits for working with AI as a learning partner
  • Identify five kinds of bugs and use the taxonomy to narrow down problems
  • Solve a Parsons problem by reasoning about data flow and execution order
  • Describe the five-step pattern every programming chapter follows

Lessons

#LessonDurationKey Focus
1The PRIMM Framework20 minThe five stages demonstrated with real Python code, the research basis, and why comprehension matters most in the AI era
2Your Workbench: Claude Code15 minSetting up Claude Code with Plan Mode, CLAUDE.md house rules, and seven slash commands that enforce PRIMM-AI+ automatically
3PRIMM-AI+: AI as Your Learning Partner15 minThree rules for working with AI, a complete walkthrough, and five habits to build as a programmer
4Completing the Toolkit15 minFive kinds of bugs, Parsons problems, and the five-step pattern every chapter follows

About the Code in This Chapter

This chapter contains simple Python code examples. Each lesson explains the code vocabulary you need before asking you to predict. You will learn Python properly starting in Chapter 45. The code here is just enough to show you how the PRIMM-AI+ method works in practice.

What Comes Next

This chapter teaches you how you will learn. The next chapter (Chapter 43: Ten Axioms) teaches what professional practice looks like. After this chapter, you will never open a programming lesson wondering what to do first. The method handles that. You focus on the code.