Fatskills
Practice. Master. Repeat.
Study Guide: Computer Science - ICT Grade 8 Python Object-Oriented Programming Basics
Source: https://www.fatskills.com/8th-grade-science/chapter/computer-science-ict-grade-8-python-object-oriented-programming-basics

Computer Science - ICT Grade 8 Python Object-Oriented Programming Basics

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~6 min read

Study Guide: Python – Object-Oriented Programming Basics (Grade 8, Computer Science/ICT)


1. The Driving Question

"If you’re building a video game where every enemy, player, and power-up has its own rules, how do you keep the code from turning into a giant, tangled mess? Why can’t you just write one long list of instructions like you did for simple scripts—and what’s the better way?"


2. The Core Idea – Built, Not Listed

Imagine you’re designing a robot soccer team in Python. Each robot has: - Attributes (speed, battery level, jersey color) - Behaviors (kick(), dodge(), recharge())

If you wrote separate code for every robot, you’d repeat the same logic over and over. Instead, you create a blueprint (a class) called Robot that defines what all robots can do. Then, you make instances of that blueprint—like player1 = Robot("red", 5)—to customize each robot without rewriting the rules. This is object-oriented programming (OOP): organizing code into reusable "objects" that bundle data and actions together, just like real-world things.

Key Vocabulary:
- Class
Definition: A blueprint for creating objects that defines their attributes and behaviors.
Example: A Dog class might include breed, age, and methods like bark() or fetch()—but it’s not a specific dog yet.
Note: In college, classes become more abstract (e.g., metaclasses, inheritance hierarchies).


  • Object (Instance)
    Definition: A specific "thing" created from a class, with its own unique data.
    Example: my_dog = Dog("Golden Retriever", 3) is an instance of the Dog class—it’s the actual dog named "Buddy" in your code.

  • Method
    Definition: A function defined inside a class that describes what an object can do.
    Example: In a Car class, accelerate() might increase the car’s speed by 10 mph each time it’s called.

  • Attribute
    Definition: A variable stored inside an object that describes its state (like properties or traits).
    Example: A Student object might have attributes name = "Jamie" and grade = 8.


3. Assessment Translation

How This Appears on Assessments:
- Classroom Formative: Short coding tasks (e.g., "Write a Book class with title, author, and a describe() method").
- State Standardized Tests (e.g., CSTA, state ICT exams): Multiple-choice questions about OOP concepts (e.g., "Which line creates an instance of a Cat class?") or debugging snippets of code.
- Performance Tasks: Build a small program (e.g., a BankAccount class with deposit() and withdraw() methods) and explain your design.

Distractor Patterns in Multiple Choice:
- Confusing class with instance (e.g., "A class is a specific object" vs. "A class is a template").
- Misidentifying methods vs. attributes (e.g., color is an attribute; paint() is a method).
- Forgetting self in method definitions (e.g., def bark(): instead of def bark(self):).

Model Proficient Response (Short Constructed Response):
Prompt: "Explain why using a Player class is better than writing separate code for each player in a game. Give an example."

Response: "Using a Player class is better because it lets you define the rules once and reuse them for every player. For example, if you write a Player class with attributes like health and score, and methods like take_damage(), you can create 100 players without rewriting the same code. If you need to change how damage works, you only update the class, not every player’s code. Without a class, you’d have to copy-paste the same logic for each player, which is messy and error-prone."


4. Mistake Taxonomy

Mistake 1: Forgetting self in Methods
Prompt: Write a Rectangle class with a method area() that calculates the area.
Common Wrong Response:


class Rectangle:
def __init__(self, width, height):
width = width
height = height
def area():
return width * height

Why It Loses Credit: - area() is missing self, so Python can’t access the object’s attributes.
- width and height in __init__ aren’t saved as attributes (no self.width).
Correct Approach:


class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def area(self):
return self.width * self.height

Mistake 2: Confusing Class and Instance
Prompt: "What does this code print? Explain."


class Dog:
species = "Canine"
def __init__(self, name):
self.name = name fido = Dog("Fido") print(fido.species)

Common Wrong Response: "It prints name because fido is an instance." Why It Loses Credit: - Misunderstands that species is a class attribute (shared by all dogs), while name is an instance attribute.
Correct Approach: "It prints Canine because species is defined for the whole Dog class, not just fido. All dogs share this attribute unless it’s overridden."

Mistake 3: Overcomplicating Inheritance
Prompt: "Write a Bird class and a Penguin class that inherits from it. Penguins can’t fly." Common Wrong Response:


class Bird:
def fly(self):
print("Flying!") class Penguin(Bird):
def fly(self):
print("I can't fly!")
def swim(self):
print("Swimming!")

Why It Loses Credit: - The student overrides fly() but doesn’t explain why inheritance is useful here (e.g., all birds share some traits, but penguins modify one).
Correct Approach:


class Bird:
def __init__(self, name):
self.name = name
def fly(self):
print(f"{self.name} is flying!") class Penguin(Bird):
def fly(self):
print(f"{self.name} can't fly, but can swim!")

Explanation: "Penguin inherits from Bird to reuse name and other bird traits, but overrides fly() to customize it. This avoids rewriting code for every bird type."


5. Connection Layer

  1. Within Computer Science:
    OOP → Data Structures — Understanding classes helps you grasp how Python’s built-in types (like list or dict) are actually objects with methods (e.g., my_list.append()).

  2. Across Subjects:
    OOP → Biology — Classes are like species: a Lion class defines traits all lions share, while simba = Lion() is an instance (a specific lion). Inheritance is like evolution (e.g., Penguin inherits from Bird but adapts).

  3. Outside School:
    OOP → Lego Sets — A Lego instruction booklet is like a class: it tells you how to build a car (attributes: wheels, color; methods: "drive"). The actual car you build is an instance. If you modify it (e.g., add a spoiler), that’s like overriding a method.


6. The Stretch Question

"If you can write any program without OOP (just using functions and variables), why do programmers bother with classes at all? What’s the real advantage—beyond just ‘it’s neater’?"

Pointer Toward the Answer: OOP’s power isn’t just organization—it’s about modeling relationships. For example, in a game, a Sword class might have a damage attribute, but a Player class could own a sword (e.g., self.weapon = Sword(10)). This lets you write code like player.attack(), where the player’s attack delegates to their weapon’s damage. Without OOP, you’d have to manually track every sword’s damage separately, which gets chaotic as the game grows. The real advantage is scalability: OOP lets you build systems where objects interact without knowing the details of each other’s code. (Think of how a light switch "knows" how to turn on a bulb, but doesn’t need to know how the bulb works internally.)



ADVERTISEMENT