A Magical Tour Through Object-Oriented Programming in Python • Hogwarts School of Codecraft and Algorithmancy
Here are all the articles in this series on object-oriented programming:
Year 1: Harry Potter and The Object-Oriented Programming Paradigm
Year 2: Let The Real Magic Begin • Creating Classes in Python
Year 3: There's A Method To The Madness • Defining Methods In Python Classes
Year 5: "You Have Your Mother's Eyes" • Inheritance in Python Classes
Year 6: Time for Something Special • Special Methods in Python Classes
Year 7: The Final Year at Hogwarts School of Codecraft and Algorithmancy
Overview of the series:
In the first year, we discuss the philosophy of OOP. What’s different about it compared to the programming you learnt before it? Why do you need it? Do you always need it use OOP? Year 1 focusses on the OOP mindset
Year 2 starts to define classes, looking at the syntax to create a class and starting to look at some of the obscure syntax we encounter in OOP, such as
__init__()
andself
We move on to defining methods in Year 3, understanding how they are attributes of an object too. An object has data and the tools to do stuff with that data. The methods are the tools for doing
In Year 4, we continue building classes with more data attributes and methods and we get classes to interact with each other
Year 5 is all about inheritance. We define classes that use other classes as a starting point
In Year 6 we explore special methods. These are the methods that start and end with double underscores. We’ve come across
__init__()
already, but now we look at a few moreIn the final year, we explore a few more topics related to classes, including static methods and class methods. We also wrap up the series