Week 1:
What an object is and how we can use objects in a program. We know that objects come from a class, which is like a blueprint, and that we can customise the attributes of an object as well as call methods on it.
Each object starts with the same attributes, but we can change each object individually, as each object is a separate instance of a class,
Glossary
Attribute – A named piece of data stored within an object. E.g: color command for turtle.
Class – A blueprint for making an object. E.g: when you create a shape, rectangle.
Instance – A specific example of an object. E.g: rect1=rectangle() rect1.set_color(“blue”)
Method – A function called upon an object allowing interaction with that object. E.g: forward command for turtle.
Object – Groups together data and functions to model something in code. Examples could include a physical item such as an LED, or a digital unit such as a bank account or an enemy in a video game
Object-oriented programming – A different style of programming.
Getter – A method whose purpose it is to get a value within an object.
Setter – A method whose purpose it is to set a value within an object.
Week 2:
Writing our own class, instantiating objects of that class with custom attribute values, and using the object’s methods to interact with it.
A class is a blueprint for creating an object.
To create an object using the class we call the method called the constructer (__init__). We can then assign attributes inside the constructer.
We also give it methods to tell it what do to.
Each object we create is an instance of its class.
Glossary
Constructor – A special method to tell Python how to create an object of this class: in Python, the constructor method is always called __init__ with a double underscore on each side of ‘init’
Dictionary – Similar to a list, but allows you to give each element a name
Element – One item in a dictionary
Getter – A method whose purpose it is to get a value from within an object
Instantiate – Create an object of a particular class
Parameter – A way of providing data so that it can be used within a method
Self – Used within the code for an object to mean ‘this object’
Week 3:
Concepts of inheritance, polymorphism, and aggregation.
A subclass inherits it’s attributes and methods from the superclass. You use inheritance to modify the subclass to suite the needs.
Polymorphism allows us to treat a subclass as if it is an object of the superclass.
Glossary
Aggregation – When an object contains an instance of (or ‘has a’) another object.
Extend – A class which uses the functionality of an existing class, but also adds to or overwrites some of it
Inherit – A class that inherits from another class is able to use all of the attributes and methods from that class
Polymorphism – If a class inherits from another class, it can also be considered to be (‘is a’) object of that class
Subclass – Inherits the properties of another class and adds some specialised methods of its own
Superclass – Provides methods and attributes which are used by another class