1/32
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a class?
A blueprint/template for an object which defines attributes and methods to capture the common behaviours and characteristics of the object
What is an object?
A particular instance of a class
What is instantiation?
Where an object is created using a contrsuctor
What is encapsulation?
Where attributes and methods are wrapped into a single entity
What is inheritance?
Creating a new class based on an existing class. The subclass inherits the methods and attributes of the superclass
What is aggregation?
A type of relationship between two class where one class has one or more instances of the other class. Using aggregation, if the containing class is destroyed the instances of the other class are not
What is composition?
A type of relationship between two class where one class has one or more instances of the other class. Using composition, if the containing class is destroyed the instances of the other class are also destroyed
What is polymorhpism?
The ability for a method to behave differently in each class in a class heirarchy
What is overidding?
The method through which polymorphism is achieved. This is when a method is redefined in a subclass
What 4 qualities are the reason the OOP paridigm is used?
It is:
1. Modular
2. Scaleable
3. Extensible
4. Reusable
How is OOP modular?
Details of implementation are hidden meaning they don't need to understand the code to use it. Objects control how they can be interfaced with meaning values can not be set to things that aren't possible
How is OOP scaleable?
It is easy to add developers and functionality to the program because the whole does not need to be understood by every programmer. It is also easier to maintain and modify code
How is OOP extensible?
It provides a good framework for expanding through libraries meaning it is easier to incorporate external code libraries or modules
How is OOP resuable?
Each object is self-contained so can easily be reused in other programs
What are the 3 main principles of OOP?
1. Encasuplate what varies
2. Favour composition over inheritance
3. Program to interfaces, not implemenation
What does 'encapsulate what varies' mean?
Any objects which change throughout your program should be wrapped up into a class and protected
Why should you 'favour composition over inheritance'?
Composition gives more flexibility and is more natural than attempting to find a family tree
What is an interface?
A collection of signatures or methods without implemenation
What does 'program to interfaces, not implemenation' mean and why should you do it?
Focusing on what your program does rather than how. This gives your program greater maintainablility, extensibility and testability
What are getter and setter methods?
Methods that allow you to get and update the attributes of an object without directly accessing those attributes
Why use getter and setter methods?
To prevent accidentally updating attributes in your program
What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes
Where can public methods/attributes be accessed?
Anywhere in the program
Where can private methods/attributes be accessed?
Only in the class that they are defined
Where can protected methods/attributes be accessed?
In the class they are defined and in any subclasses
What does UML stand for?
Unified Modeling Language
What is UML used for?
To create class diagrams in order to visualise, construct and document software
How are public methods/attributes represented in UML?
With a + before the method/attribute
How are private methods/attributes represented in UML?
With a - before the method/attribute
How are protected methods/attributes represented in UML?
With a # before the method/attribute
How is inheritance represented in UML?
A line connecting the two classes with an unfilled arrow pointing to the superclass
How is composition represented in UML?
A line connecting the two classes with a filled diamond next to the container class
How is aggregation represented in UML?
A line connecting the two classes with an unfilled diamond next to the container class