Object-Oriented Programming
Lecturer: Dr. Stefano Gogioso
This module teaches the principles of object-oriented programming. The language used in this module is Python 3.12, but the majority of concepts covered will apply just as well to other object-oriented languages. For a detailed description of the topics that will be covered, please refer to the Contents section below.
Frequency:This course normally runs three times a year.
Course dates
14th October 2024 | Oxford University Department of Computer Science - Held in the Department | 0 places remaining. |
3rd February 2025 | Oxford University Department of Computer Science - Held in the Department | 0 places remaining. |
2nd June 2025 | Oxford University Department of Computer Science - Held in the Department | 01 place remaining. |
Objectives
On completion, you will be able to design and implement solutions to real-world programming tasks using object-oriented principles and techniques, in Python 3.12.
Contents
Pre-study
The pre-study for this module consists of a selection of examples and short exercises that will allow you to familiarise yourselves with Python programming: you should ensure that you understand the material and complete the exercises before the start of the teaching week. A brief Q&A will be held on Monday morning to clarify any outstanding points, but the pre-study materials will otherwise be taken for understood.
- Pre-study: basic setup, basic syntax, basic built-in types (bool, int, float, str, bytes, list, set, dict), functions (including args/kwargs), modules, some conventions (indentation, casing, use of underscores for access control).
Should you wish to dig deeper, a more comprehensive tutorial for Python 3.12 is available at: https://docs.python.org/3.12/tutorial/index.html
Teaching Week
The following material is covered in detail during the teaching week:
- Objects: Attributes, methods and properties for built-in types. User-defined classes, instance attributes, instance methods and instance properties. Operators and magic methods.
- SOLID Principles: Single-responsibility principle and encapsulation. Open-closed principle, class extension and the MRO, abstract classes, composition over inheritance. Liskov substitution principle. Interface segregation principle. Dependency-inversion principle.
- Object-Oriented Patterns: builder, companion object, facade, factory, fluent interface, flyweight, lazy evaluation, memento, prototype, publish-subscribe, singleton, state, visitor.
- Advanced features: Function overloading. Static and class methods. Meta-classes and the object creation mechanism. Slots, object dictionary, other magic attributes. Contexts. Generators and asynchronous primitives. Descriptors.
Each topic will be briefly introduced by slides, followed by hands-on programming exercises and live-coded solutions. It is presumed that you will be able to write and execute Python 3.12 code in class during the exercises: it is heavily recommended that you practice writing code before the start of the teaching week, by completing the pre-study exercises and/or by means of other online resources (tutorials, code challenges, etc). If you plan to use your machine during the teaching weak, please make sure that it is set up before the start of the week.
Requirements
Solid practical experience with imperative programming languages is a pre-requisite for this course.