Module 07 — Classes and Object-Oriented Programming#

Graduate MSBA Module Overview

As analytics systems grow more complex, organizing code around functions alone becomes insufficient. Object-oriented programming introduces a more powerful organizational model: classes. A class is a blueprint for creating objects — custom data structures that bundle both data and the functions that operate on that data into a single, cohesive unit.

A Customer class might hold a customer’s name, ID, and purchase history while also containing methods to calculate their tier, compute their lifetime value, or generate a summary report. Classes embody both abstraction and polymorphism — two of the four core programming principles.


Course Connections#

Understanding classes is essential for modern analytics work because every major Python library is built on object-oriented principles. When you work with Pandas DataFrames, you are working with objects. When you use Matplotlib to create charts, you are working with objects. You don’t need to become an expert object-oriented programmer, but you do need to understand the model well enough to work confidently with the tools built on it.


Quick Code Example#

class Customer:
    def __init__(self, name, customer_id, region):
        self.name = name
        self.customer_id = customer_id
        self.region = region
        self.purchases = []

    def add_purchase(self, amount):
        self.purchases.append(amount)

    def total_spent(self):
        return sum(self.purchases)

    def customer_tier(self):
        total = self.total_spent()
        if total >= 1000:
            return 'Platinum'
        elif total >= 500:
            return 'Gold'
        else:
            return 'Standard'

    def summary(self):
        return f"{self.name} | Region: {self.region} | Total: ${self.total_spent():.2f} | Tier: {self.customer_tier()}"

alice = Customer('Alice Johnson', 1001, 'Northwest')
alice.add_purchase(250.50)
alice.add_purchase(420.25)
alice.add_purchase(180.75)

print(alice.summary())
print('Purchase Count:', len(alice.purchases))

Expected Output:

Alice Johnson | Region: Northwest | Total: $851.50 | Tier: Gold
Purchase Count: 3

Learning Progression#

Platform Student Learning Experience
NotebookLM Explore classes through business storytelling that shows how organizing data and behavior together into objects mirrors how businesses think about entities
Google Colab Define classes, create objects, and call methods in Python
Zybooks Reinforce class syntax and object-oriented patterns through structured practice exercises

Module Pages#