Introduction: Object-oriented programming 🎁

Welcome to the home stretch of the course. You're two thirds of the way through, and the final module is a light one, so there are only three more modules of substantive content left!

These modules cover Object-Oriented Programming or OOP. Don't worry, it's not something brand new and different, just a way of packaging the algorithms and data structures you've been working with into larger chunks called objects. This makes them even easier to reuse and to connect together into larger programs.

There is some new notation and jargon, so to help you concentrate on that we'll revisit a programming domain we've already seen, playing cards, and repackage our techniques and data structures for dealing with them into classes and objects. We'll develop a set of playing card classes in this module. Be sure to follow that development carefully, since three of your four assignment problems involve it.

(Next week we'll consider a new problem domain that has been students' favourite assignment over the years, the world of the original text adventure game "Hunt the Wumpus".)

  1. Object-Oriented Programming
  2. Encapsulation
  3. Inheritance
  4. Polymorphism
  5. The plan for the next three modules
  6. A small example: A dice class
  7. Python OOP Syntax
  8. Playing Card Classes: The Specification
  9. Identifying the necessary classes
  10. Identifying the classes' methods
  11. Program skeleton 1
  12. An invisible method! (A polymorphic aside)
  13. Program Skeleton 2
  14. An invisible class too!
  15. Deck methods
  16. Hand methods
  17. Card Methods
  18. Putting all the pieces together
  19. Running the whole thing
  20. Programming Observation 1. Assignment 9