Classes and objects
A class is the blueprint; an object is one thing built from it. The cookie cutter is not the cookie.
Until now you used things Python provided. Now you invent your own.
A class is a blueprint that bundles data and the actions that belong with it. One VirtualPet class can produce a hundred pets, each with its own name, hunger and mood, all sharing the same behaviour.
Object-oriented thinking is how large software is organised. Meeting it through a virtual pet makes an abstract idea immediately concrete.
Three core ideas, each taught with worked examples and then practised until it feels obvious.
A class is the blueprint; an object is one thing built from it. The cookie cutter is not the cookie.
Attributes are what an object knows — its name, its energy, its score. Each object keeps its own copy.
Methods are what an object can do, and they can change its own attributes. pet.feed() raises that pet’s energy and nobody else’s.
The Tamagotchi sold over 90 million units on exactly this logic: a few attributes, a few methods and a timer.
“self is a magic word.” self is simply the object talking about itself — “my name”, “my energy” — and Python passes it in automatically.
Sessions 33–40 of the 72-session year, at two one-hour sessions per week.
Where this module fits, what you will build, and a hands-on starter that gets everyone curious about classes and objects.
Guided teaching on classes and objects, worked through together with the teacher.
Independent practice, small challenges and one deliberate mistake to diagnose.
Guided teaching on attributes, building directly on the previous two sessions.
Applied tasks that combine classes and objects and attributes in one piece of work.
Methods introduced and practised, completing the toolkit needed for the project.
Guided build session for the module project: Virtual pet system.
Finish, test against the checklist, present the work and explain the decisions behind it.
Every module ends with something the student built themselves and can demonstrate. This is the piece that goes into their portfolio and gets explained out loud at the end of session 40.
Give your pet a mood that depends on hunger, energy and how long since you last played. Then create three pets and neglect one on purpose.
Students finishing Module 5 can:
The vocabulary introduced here, in plain language:
6 quick questions drawn from this module — vocabulary, the project you build, and a myth-or-fact round. Every wrong answer explains itself, so a mistake still teaches you something.
Tell us your child’s class and what they enjoy. We will suggest the closest program fit—no pressure and no upfront payment.