Chris Walshaw
 Teaching
 Research
 Enterprise & KE
 Music
 Contact

Object Oriented Programming in Python

Welcome to Object Oriented Programming (OOP) in Python, a 9-topic course in the concept of OOP with the popular programming language Python.

Each topic has a YouTube playlist with 6-10 short videos (roughly an hour long) accompanied by a zip file of downloadable standalone examples. The examples all use Python but I give comparisons with other popular languages (such as C, Java and JavaScript) along the way.

Obviously you can dip in and out of the videos, using the lists of contents below as an index, but if you want to take the whole course, I recommend watching one topic a week (or one a day if you are in a hurry) and then practising with the examples to build your skills up.

Please feel free to leave comments on the videos (questions or constructive criticism) and I will reply to you as soon as I get the chance. I also recommend subscribing to my YouTube channel for addition courses that I will be releasing.

Topic 01 Introduction

YouTube Introduction playlist:

  • Video 01-1 - Objectives & motivation: Objectives. Textbooks. Motivation. Examples.
  • Video 01-2 - PyCharm: PyCharm installation & settings. Opening examples. Running a program.
  • Video 01-3 - Home hub example: Home hub - lists, devices, commands, output.
  • Video 01-4 - Uni app example: Uni app - lists, initialisation, main loop, output.
  • Video 01-5 - Pizza example: Pizza - lists, random toppings, output. Object-oriented programming rationale. Summary

Downloadable Introduction examples

Topic 02 Tuples

YouTube Tuples playlist:

  • Video 02-1 - Objectives & motivation: Motivation. Objectives. Tuples. Tuples from functions.
  • Video 02-2 - Tuples: Tuples. Tuples from functions. Pizza app examples 02 & 03. The enumerate() function.
  • Video 02-3 - Triples: Multiple values. Uni app example.
  • Video 02-4 - Dictionaries: Dictionary initialisation. Dictionary usage.
  • Video 02-5 - Dictionary example: Pizza app example 04. Random pizza. Pizza GUI
  • Video 02-6 - Summary: Dictionaries vs lists. Summary

Downloadable Tuples examples

Topic 03 Classes

YouTube Classes playlist:

  • Video 03-1 - Objectives & motivation: Objectives. Motivation. Motivating example. Simulation.
  • Video 03-2 - Home hub - single class: Home hub with one device. Ceiling light class. Test code. Controller. Main loop. Notes.
  • Video 03-3 - Home hub - multiple classes: Home hub with multiple devices. Light classes. Spotlight class (dimmable). Heating class. Music player class. Controller.
  • Video 03-4 - The hasattr() function: Using hasattr(). Parsing block. Example output.
  • Video 03-5 - Lucky pizza: Random pizza example. Pizza class. Lucky pizza. Summary.

Downloadable Classes examples

Topic 04 Objects

YouTube Objects playlist:

  • Video 04-1 - Objectives & motivation: Objectives. Motivation.
  • Video 04-2 - Home hub - multiple objects: Home hub example 04. Light class. Light objects. Using objects. Code reuse.
  • Video 04-3 - Lucky pizzas: Pizza app example 06 - basket. Pizza class. Pizza generation. Output.
  • Video 04-4 - Uni app - classes: Uni app example 03. Person class. User class. Staff class. Student class. User database.
  • Video 04-5 - Uni app - usage: Initialisation. Main loop. Summary.

Downloadable Objects examples

Topic 05 GUIs

YouTube GUIs playlist:

  • Video 05-1 - Objectives & motivation: Objectives. Motivation.
  • Video 05-2 - tkinter - basic usage: tkinter module. Principles - window, widgets, callbacks. Button example.
  • Video 05-3 - tkinter - text fields: tkinter variables. StringVar. Entry. Text fields.
  • Video 05-4 - tkinter - checkboxes, radio buttons, comboboxes: BooleanVar / IntVar. Checkbutton. Radiobutton.
  • Video 05-5 - tkinter - comboboxes: Drop down list. Combobox.
  • Video 05-6 - Uni app GUI: Putting it into practice. Uni app example 04. clicked() function.
  • Video 05-7 - Home hub GUI: Home hub example 05. Light class. Scale slider. respond() function.
  • Video 05-8 - Pizza GUI: Pizza example 07. respond() function. add_to_basket() function. Summary.

Downloadable GUIs examples

Topic 06 Testing

YouTube Testing playlist:

  • Video 06-1 - Objectives & motivation: Objectives. Motivation.
  • Video 06-2 - Unit testing: Definition. Professional Practice. What to test?
  • Video 06-3 - pytest: pytest module. Configuring PyCharm. Using pytest - assert. Using pytest - capsys.
  • Video 06-4 - Uni app - tests: Uni app testing. User tests. Student tests. Running the tests.
  • Video 06-5 - Uni app - combined tests: Uni app combined tests. Main code. check() function.
  • Video 06-6 - Pizza app - testing: Pizza tests. Test code. Pizza code.
  • Video 06-7 - Home hub - testing: Hub tests. Test code. check_on_off() function. Running all tests. Summary.

Downloadable Testing examples

Topic 07 Exceptions

YouTube Exceptions playlist:

  • Video 07-1 - Objectives & motivation: Objectives. Motivation.
  • Video 07-2 - Uni app - csv database: External resources. Uni app example 07 - people.csv. Getting fields. Reading cells. Processing modules.csv. Python and csv files.
  • Video 07-3 - File access errors: Error-handling. Exceptions. Uni app - access errors.
  • Video 07-4 - Memory errors: Running out of memory. Lucky pizza example 09 - MemoryError.
  • Video 07-5 - Attribute errors: Checking attributes. Uni app 07 controller. Duck typing.
  • Video 07-6 - Home-made exceptions: Common exceptions. Home-made exceptions. Non-negative integer exception. Summary.

Downloadable Exceptions examples

Topic 08 Inheritance

YouTube Inheritance playlist:

  • Video 08-1 - Objectives & motivation: Objectives. Motivation.
  • Video 08-2 - Concept: In real life. In programming. So what?
  • Video 08-3 - Modelling: Back to programming. Inheritance terminology. Universal Modelling Language (UML).
  • Video 08-4 - Uni app - inheriting methods: Inheritance in Python. Uni app example 08 - classes. Inheriting methods.
  • Video 08-5 - Uni app - overriding methods: Overriding methods. Uni app example 09 - Person class. User / Student / Staff classes. UML. GUI.
  • Video 08-6 - Uni app - encapsulation: Encapsulation. Uni app example 10 - classes.
  • Video 08-7 - Home hub - inheritance: Home hub example 08. Lights classes. Summary.

Downloadable Inheritance examples

Topic 09 Polymorphism

YouTube Polymorphism playlist:

  • Video 09-1 - Objectives & motivation: Objectives. Motivation.
  • Video 09-2 - Home hub - polymorphism: Polymorphism. Home hub example 09 - class diagram. Switchable class. Settable class.
  • Video 09-3 - Home hub - classes: Hub device classes. MusicPlayer class. Notes.
  • Video 09-4 - Pizzas - abstraction: Abstraction motivation. Pizza app example 10 - products. Pizza app code. Product class.
  • Video 09-5 - Coffees - reusable GUI: Pizza app example 11 - reuse. Product GUI. Pizzas & coffees. Summary.

Downloadable Polymorphism examples


©