|
Part One: AbstractionBefore starting to learn how to program using OOP method, it is important to understand abstraction and how to apply this when programming an efficient solution.
First read this description of abstraction from BBC Bitesize: BBC Bitesize: Abstraction Then watch the video opposite which explains how it relates to OOP. Further reading: Computational Thinking and Thinking About Computing Wikipedia: Abstraction (Computer Science) Stackoverflow: Community Explanation Once you have a reasonable understanding of what abstraction is, it is time to start programming and putting it into practice. Python School has a really good tutorial for OOP. Python School Tutorial Complete the Task 1 and then return here. |
Part Two: EncapsulationNow you noticed when you were creating your class, that you kept the attributes private. This is called encapsulation.
Watch the video opposite for an explanation. Complete Task 2 and then read the further explanation of encapsulation at the bottom of the page. Python School: Task 2 Continue up to Task 6. Further reading: Wikipedia: Encapsulation (Computer Programming) |
|
|
Part Three (a): InheritanceInheritance is when a class inherits attributes from another class. That class that inherits properties is called a sub-class. The class that it inherits from is called the superclass.
Further reading: Python tutorial: Inheritance example Object-oriented programming concepts: Inheritance Wikipedia: Inheritance (Object-Oriented Programming) |
Part Three (b): PolymorphismPolymorphism in OOP is when a sub-class overrides a procedure or function that it has inherited from its superclass.
It is used so you can specialise a class whilst keeping the interface (function and procedure names) the same. Complete the tutorial to Task 8. Further reading: Object-oriented programming concepts: Polymorphism and interfaces Wikipedia: Polymorphism (computer science) |
|