
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Welcome to the course, let's get started!
All videos are done in Visual Studio Code, and in this session I'll introduce my working environment setup.
Python is an OOP language, and we can use some of the built-in types to explain the most basics ideas of OOP.
In this 'Hello World' style session, we'll construct our first ever class, and then create an instance of it.
An instance is an object created from our class template, in this session we'll look at how to give each instance its own information, we'll call this an instance attribute.
A method is something that instance can 'do', just like a list can append, extend etc.. In this session we'll discover how to create a simple instance method.
There's a decent amount of new lingo in OOP, let's quickly recap these terms before moving on.
In this session we'll get to grips with how constructors work, and how they can be used to perform initial setup.
To round off this section, we'll build a Car class with its own constructor, attributes and methods.
In this session it's down to you! You'll be asked to create 2 classes with their own constructors.
A constructor is used to perform some initial setup on an instance of a class, in this session we'll look at how they're implemented, with some simple examples.
In this session we'll go through the design of this rather cool little program!
In this session we'll write roughly half of the code for the quiz.
In this session we'll finish off and test the quiz.
In this session we'll examine the use of attributes that belong to the class, rather than the instance itself.
Just like how attributes can belong to the class, methods can too! Let's learn how it's done.
In this session we'll write some class methods in a range of scenarios.
It's over to you! In this session you'll be asked to write some class attributes and methods.
We can use class methods as constructors in specific scenarios, let’s take a look.
A static method is a special kind of function that belongs to the class, but doesn't have access to any of its attributes. Let's explore them!
In this session we'll write a range of different static methods to see how they work in practice.
In this stop and code session you'll be asked to write a couple of static methods to test your understanding.
A magic method (also called a dunder method) is invoked by either an operator, or a built-in function. We'll explore the implications of this in this introductory session.
Print is a pretty important function right? In this session we'll explore __str__ and __repr__ to allow for proper printing of our instances.
In this session we'll explore how to make the basic comparison methods work with instances of our classes. These include the equal to, more than, less than operators and so on!
In this session we'll look at how to implement some commonly used magic methods, which in turn allow us to use some of the basic built-in functions on our classes. Methods in this video are: __len__ & __add__
In this session we'll allow for our instances to be iterable, by implementing __iter__ & __next__
We can implement the __enter__ and __exit__ methods to enable our classes to be used with the 'with open' syntax, commonly used when working with files.
In this video we'll look at how to make 'dictionary style' accessing work by implementing __getitem__ & __setitem__
Properties are a special kind of attribute with some interesting properties, let's explore why they're used.
In this session we'll write some basic properties with some real life examples.
A well written property setter performs validation, and sets a property if this passes. Let's write some!
The del() function relies on a property deleter being set, and we'll learn how to use them in this section.
To round off this section, let's test your knowledge in creating properties, setters and deleters.
We're going to create a weather watcher by writing a weather watcher, and incorporate all we've learnt so far. In this session we'll plan our classes, attributes, properties and methods. The source code is in the next video!
In this session we'll start on the code and run some tests.
We'll finish the code in this session, and run some final tests.
Inheritance and Composition are commonly used features of OOP. In this section we'll justify their use, and learn about how they can make for more efficient working.
Inheritance is where one class takes all the attributes and methods from another, acting as its 'child'. Let's look at some examples.
Composition is slightly related to inheritance but it is inherently different, we'll explore the differences and write some examples here.
it's time to test your knowledge. In this session you'll be asked to write some code to demonstrate your skills in inheritance and composition.
We'll piece together the contents from this session to create a range of classes which use inheritance and composition.
Welcome to Object Oriented Programming in Python 3
This course has been carefully designed to deliver the skills needed to master OOP in Python. You can expect to be coding from the very first section and you’ll be asked to think, problem solve, plan and code throughout the entire course.
Learning and building up a practical understanding is more effective with a hands-on approach, and this course teaches OOP in a way that is meaningful, easily accessible and always provides links to real-world use cases. Each section has coding exercises, quizzes and stop-and-code sessions. These get progressively more challenging and continuously build on the skills you’ve learnt in previous sections.
Course Curriculum
Over the course, we will cover the following areas:
Visual Studio code + Environment Setup
OOP basics and Terminology
Creating Classes and Instances
Constructors (__init__ methods)
Instance Attributes & Methods
Class Attributes & Methods
Static Methods
Properties (Getters, Setters, Deleters)
Magic Methods (Also known as Dunder Methods)
Inheritance & Composition
SOLID Design Principles
Data Classes
Abstract Base Classes
Miscellanous Features - Enums, Slots, Descriptors, Multiple Inheritance
Coding Projects
To give you as many chances as possible to use and develop your OOP skills, you’ll be working on 2 different projects during the course.
1. A Multi Player Quiz - In this project you'll use the knowledge from the first half of the course to construct several classes to build a quiz, with classes representing the questions and the players. You'll then create a class to control the game logic. This project will be written to a professional standard with type hints & documentation strings.
2. An Automatic Weather Notifier - This complex program will call a weather API to fetch the weather, and then use scheduling to do this on a predetermined basis. You'll then create a class to enable weather alerts and information to be emailed. This will be written to the same professional standard as the multi player quiz.
Coding Challenges
The course contains coding challenges throughout, and these are designed to test your knowledge on all aspects of object orientation.
Prerequisites
It's recommended to have a basic grasp of Python before starting, such as knowing how to use strings, integers/floats, booleans. Knowing the differences between lists/tuples/sets and dictionaries, knowing how to write loops and functions, and also knowing how to work with error handling. Feel free to check out my beginner course via my Udemy profile!