Classes and Object-oriented Programming
Lecture Slides Lecture Slides (pdf) Lecture Slides (ipynb)
Tutorial Exercise Tutorial Exercise (pdf) Tutorial Exercise (ipynb)
We saw how functions allow us to make our code more generalisable and abstract. But what if we wanted to bundle our code with the kinds of data it could operate on? Classes and object-oriented programming allow us to address this challenge.
Required Readings
- Guttag Ch 10: Classes and Object-oriented Programming;
Additional Readings
- Wickham Chs Object-oriented programming: Introduction, 12: Base types, 13: S3;
- Bjarne Stroustrup. 1991. What is “Object-Oriented Programming”? (1991 revised version). *Proceedings of the 1st European Software Festival, https://stroustrup.com/whatis.pdf
Tutorial
- Working with classes and methods.