4.1.2 FoP (Programming Paradigms) Flashcards
What is meant by a Class
Software blueprint or template for implementing objects of a given type which specifies that data fields and methods that objects will have
What is an Object
An instance of a class, that has a collection of of data fields and methods that operate on these data fields
What is meant by the term Encapsulation
The practice and ability to hide or isolate the internal components (data) and operations (methods) of an object, allowing the user only to communicate only through the public interface.
What is it meant for an object to be ‘black-boxed’
If an object is properly encapsulated, it will only reveal the information needed to reuse its members through the public interface
What is meant by the term inheritance
The relationship among classes wherein one class shares the data structure and behaviours of another, meaning it has the same properties and methods as its parent class.
What is meant by Polymorphism
It refers to the programming language’s ability to process objects differently depending on class or data type
What is Inheritance based Polymorphism
A situation when the method in the base class is inherited in the derived class, but is redefined to suit the data and purpose of the derived class.
What is meant by Method Overloading
When multiple methods in the same class have the same name but a different parameter list.
What is meant by Overriding
Methods will allow a derived class to alter the behaviour that is inherited from the base class, whilst maintaining the same method call and signature.
What is Interface based Polymorphism
When an interface is created and is implemented differently in several classes, making the method call the same but the algorithm potentially differently
What is meant by Aggregation
When an object may be built up from other objects, and is based on the way in which objects are related
What is Association Aggregation
When an object has a relation but no dependency on the existence of another object (if one is destroyed the other still exists)
What is Composition Aggregation
When an object has a relation an dependency on the existence of another object (if one is destroyed the other no longer exists)
What are the three Advanced Design Principles
- Encapsulates What Varies
- Favour Composition over Inheritance
- Program to interfaces, not Implementation
What does it mean to Encapsulate What Varies
The idea that where there is a variance, there should be a class for it