L2 Lesson Plan - OOP - KS4
L2 Lesson Plan - OOP - KS4
Learning objectives
● Describe the relationship between a class and an object
● Model a real world problem using object oriented programming conventions.
● Define attributes and methods as a part of a class
● Use a constructor to create objects
● Use a method and access an attribute on an object
Key vocabulary
Class, object, instance, attribute, method, constructor, getter, setter
Preparation
Subject knowledge:
For this lesson you will need a solid understanding of the key principles of object-
oriented programming. You will also need to know how to create an object class in
Python, implement get and set methods and instantiate objects using the class.
It is also advisable that pairings for the pair programming activity are decided in
advance in order to not waste lesson time.
Assessment opportunities
In the pair programming activities (activity 3 and 4 in particular) there is an opportunity
to determine if students have grasped the concepts in the lesson. The plenary is a
keyword definition matching activity to see if students can match up the keywords from
the lesson to the correct definition.
Outline plan
Please note that the slide deck labels the activities in the top right-hand corner to help
you navigate the lesson.
Some possible suggestions from students are shown on slide 2, and whilst
they are true, some are only applicable to a subset of the animal kingdom.
Try and prompt students to come up with a narrow list that applies to all
animals, such as the list you can show on slide 4.
You should then move on to show the examples on slides 7 and 8 where
cars and houses are defined as objects, showing what attributes and
methods or actions they can have. In both cases it is important to highlight
that the objects within their individual category share attributes, for
instance all cars have a make and model, but not all cars have the same
make and model.
With the aid of the video on slide 9, you can then introduce students to an
object class, this will explain that an object class is the template or blueprint
for creating objects of the same type.
students will now follow a live coding session whilst pair programming with
another learner. You should demonstrate how to create a template for the
object Pet as shown starting on slide 12. The live coding/pair programming
activity should continue, creating a new file to demonstrate how to create
an instance of an object. Ensure students are paying attention up to the
point where the code is complete before attempting it themselves.
Finally, on slide 17, students are presented with the completed code for both
files and should be prompted to execute mypet.py, at this point it is
important to explain to students that whilst the program produces no
output at this stage, an instance of their object has been created in
memory.
Finally, students can create their own method in their object class to
describe their pet. This will demonstrate how information can be obtained
through just calling one method that calls the getters itself.
Homework N/A
Resources are updated regularly — the latest version is available at: ncce.io/tcc.
This resource is licensed under the Open Government Licence, version 3. For more information on this
licence, see ncce.io/ogl.