This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 6: Object methods

Summary

face Josiah Wang

You should now have a more complete picture of what objects actually are and how they relate to classes.

As a recap, remember how we started modelling the structure of an object using dict? This gives a better abstraction to real world objects compared to basic data types. We then started to really define a proper structure to an object via class definitions.

The attributes of a class instance represent the state or structure of the object (what the object has).

The methods of a class instance represent the behaviour of the object (what the object can do). Methods have access to the attributes of the object. This allows them to be more closely tied (or ‘coupled’) to the object, compared to a typical function.

Objects are the main unit in the object-oriented programming paradigm, where they are the ‘main stars’ or actors in the program. In the next lesson, you will start to see how different objects can interact with each other to form a program written in an object-oriented style.