Before You Begin

Let's get you set up

Enter your name and class to start the Interactive OOP Learning Lab. This is also the name that will appear on the final class challenge leaderboard.

Welcome

Object-Oriented Programming, Learned by Doing

Object-Oriented Programming becomes easier when we learn by doing. Complete the activities below to explore classes, objects, attributes, methods, and the four main principles of OOP.

6 Hands-on Activities 1 Cybersecurity Case Study 5-Minute Class Challenge

Section 1

What Is OOP?

Object-Oriented Programming (OOP) is a programming paradigm that organizes software around objects, which combine data (attributes) and behavior (methods).

Objects Represent Real-World Entities

Student
Car
Bank Account
Professor
Security Incident
User Account

Class → Objects

Class (Blueprint)

Student

Sara
Ahmed
Lina

Class = Blueprint  ·  Object = Instance created from the blueprint

Activity 1: Class or Object?

Not started

Decide whether each item represents a class or an object.

Instructor note: Ask students out loud before revealing the buttons’ result. Pause 3–5 seconds before clicking.

Vote, Argue, Vote Again

Predict: What Does taxi Show?

Read the code, then vote for what you think it prints. We will show the room’s results live. Argue your answer with a neighbor, then vote again before we reveal the answer.

class Car:
    def __init__(self):
        self.speed = 0

    def accelerate(self):
        self.speed += 10

my_car = Car()
taxi   = Car()

my_car.accelerate()
my_car.accelerate()

print(taxi.speed)
Round 1 · Cast Your Vote

Section 2

Attribute or Method?

Attributes describe what an object HAS.

Methods describe what an object CAN DO.

Example: Student Object

Attributes

  • name
  • studentID
  • GPA
  • major

Methods

  • study()
  • registerCourse()
  • submitAssignment()
  • viewGrade()

Activity 2: Attribute or Method?

Not started

Click each item below and classify it as an Attribute or a Method.

Instructor note: This works well as a rapid-fire class activity. Ask for a show of hands before each click.

Section 3

Activity 3: Build Your Own Class

Not started

Choose a class, then select the attributes and methods that belong to it.

Instructor note: Have the class vote on which category to build. Ask why each distractor is wrong before checking.

Section 4

Activity 4: From Class to Object

Not started

A class is the blueprint. Now let’s create an object.

Instructor note: Fill the form live with a volunteer’s own name and major to make it personal.

Section 5

Activity 5: Fix the Python Code

Not started

Read the code below. Something is broken.

class Student:
    def __init__(self, name, major):
        self.name = name
        self.major = major

    def study(self):
        print(name + " is studying")

student1 = Student("Sara", "Cybersecurity")
student1.study()

What is wrong with the code?

Instructor note: Ask “What does self refer to?” before revealing option B is correct.

Section 6

The Four Pillars of OOP

Encapsulation

Encapsulation bundles data and methods together and controls access to an object’s internal state.

Example: A Bank Account’s balance should not be changed directly. Use deposit() and withdraw() instead.

Simple idea: Protect and control data.

Abstraction

Abstraction hides unnecessary implementation details and shows only what the user needs.

Example: A driver uses car.start() without needing to understand the engine system.

Simple idea: Hide complexity.

Inheritance

Inheritance allows one class to reuse and extend the attributes and methods of another class.

Example: Employee → Professor. A Professor is an Employee.

class Employee:
    ...

class Professor(Employee):
    ...

Simple idea: Reuse and extend.

Polymorphism

Polymorphism allows the same method or interface to behave differently depending on the object.

Example: Professor.work(), Engineer.work(), and Doctor.work() all use work() but produce different behavior.

Simple idea: Same interface, different behavior.

Activity 6: Which OOP Principle Is This?

Not started

Read each scenario and choose the OOP principle it demonstrates.

Cybersecurity Case Study

Design a Security Incident Class

We can also apply OOP to cybersecurity systems. Below is a class used inside a Security Operations Center (SOC) to track incidents.

Possible Attributes

  • incidentID
  • severity
  • status
  • detectionTime
  • assignedAnalyst

Possible Methods

  • assignAnalyst()
  • escalate()
  • closeIncident()
  • generateReport()

Classify each item below as an Attribute or a Method:

The Completed Class

class SecurityIncident:
    def __init__(self, incident_id, severity, status):
        self.incident_id = incident_id
        self.severity = severity
        self.status = status

    def escalate(self):
        print("Incident escalated")

incident1 = SecurityIncident("INC-001", "High", "Open")

Live SOC Dashboard

Instructor note: Frame this as “incident1 is an object of the SecurityIncident class. Watch what happens when we call a method on it.”

INC-001 Open
SeverityHigh
StatusOpen

Final Assessment

The 5-Minute Class Challenge

Five questions covering everything from this lab: classes, objects, attributes, methods, and the four pillars. Enter your name, race the clock, and climb the leaderboard.

Ready to compete, ?

You will have 5 minutes to answer all 5 questions.

Top 10 Leaderboard

0 entries

Ranked by score, then by fastest time.

Rank Name Class Score Time

No one has taken the challenge yet. Be the first!