What is the advantage of favouring composition over inheritance?
It makes it easier to test each class using unit testing
What is the similarity between composition and aggregation?
Both “has a” relationships (ownership)
What is the difference between composition and aggregation?
(composition = strong ownership, aggregation = weak ownership)
Give the advantages of using subroutines:
Give 3 points.
Any 3 points:
- Code re-use
- Allows for modularisation of the program
- It makes it easier to identify bugs
- It makes it easier to test individual tasks NE easier to test
- It makes it easier for other programmers to interpret and understand your code
What is an object reference variable?
What is the purpose of a class?
To define the method and property fields that capture the common behaviours and characteristics of objects
How is composition represented in UML?
Black diamond
How is aggregation represented in UML?
White diamond on the owning class.
What is encapsulation?
What is a constructor?
A method that is called when an object is first created
What is the purpose of inheritance?
To create a hierarchy of specialisation for classes
What is (subtype) polymorphism? What is its purpose?
Give two advantages of the “programming to interfaces, not implementation” design principle:
What is a constant?
A data item that, once declared, retains the same value for the entire duration of the program run
Give two advantages of using constants over local variables:
What does the access modifier protected mean? Give its UML symbol.
#What does the access modifier public mean? Give its UML symbol.
+What does the access modifier private mean? Give its UML symbol.
-What is the purpose of a hierarchy chart?
Constructing a hierarchy chart aids with which type of abstraction?
Decomposition
What is meant by a structured programming approach?
What are user-defined data types?
Data types that are derived from existing built-in types in order to create a customised data structure
Give advantages of OOP:
Give drawbacks of OOP: