Skip to content

Week 05 - October 14

Class Description

This week marks a major milestone in your programming journey: Object-Oriented Programming (OOP)! We'll learn how to create our own custom data types using classes, and we'll immediately apply this to combinatorics—the mathematical art of counting. You'll discover that mathematical objects like fractions, combinations, and permutations are natural and intuitive first examples of OOP concepts.

Key Insight: Mathematical objects have properties (state) and behaviors (operations), just like objects in programming! A Fraction has a numerator and denominator (state) and can add, multiply, and simplify itself (behaviors). This makes mathematical entities perfect for learning OOP.

Key Learning Objectives: - Understand what objects and classes are in programming - Learn to define your own classes with __init__, methods, and special functions - Apply OOP to create mathematical objects (fractions, combinations, permutations) - Master combinatorial counting: factorials, permutations, combinations - Understand Pascal's triangle and binomial coefficients - See how objects encapsulate both data and behavior

Why OOP Now?: Introducing OOP early (rather than at the end of the course) gives you 6+ weeks to practice and allows us to write more elegant, powerful code for the rest of the semester. Complex topics like probability, graphs, and algorithms become much more intuitive when you can create objects to represent them!

This is a paradigm shift in how you think about programming—be patient with yourself, and remember that every expert programmer once found OOP confusing!

Before Class

Flipped Classroom Reminder

Remember: Watch the videos before class so we can spend our time together on active learning and problem-solving!

Videos to Watch Before Class

Please watch the following videos before our class meeting:

CS 5001 - Introduction to Classes and Objects

Foundation: Understanding Objects

Creating Your Own Classes

Optional (we'll cover these later):

CS 5002 - Module 5: Combinatorics

Fundamental Counting

Advanced Counting

Alternative videos:

Note: This is a big conceptual leap week. Don't worry if OOP doesn't click immediately—many students find it confusing at first but have an "aha moment" during the hands-on studio activities. The combination of mathematical objects and practical coding will help solidify the concepts!

Class Materials

đź“‹ Handouts

To be added

đź’» Code Examples

Interactive Python examples to explore during and after class:

To be added