Programming Paradigm
No description yet. This curated deck is ready for daily study.
Card preview (17)
What is an object
a container used to store both data and instruction , it is created from classes using instantiation
WHat is a class
specify what properties and methods objects of their type would have
WHat is a private method
Can only be accessed within the class it was declared and nowhere else (two underscore )
WHat is a public method
a function or procedure within a class that’s accessible and callable from any other part of the program, inside or outside its class
what is a protected method
A protected method is a class function that is intended to be accessible only within the class itself and its subclasses (child classes) one underscore
WHat is encapsulation
grouping of attributes and methods are stored in the objects / combining methods and procedures to form an object
WHat is inheritance
allows one class to share the properties and methods of another class . It “is a “ relationship
What is polymorphism
WHen objects are processed differently depending on their class
WHat is overriding
Sane name as a method in an inherited class but different implementation
What is association
descibed as having a “has a “ relationship
WHat is aggregation
weaker type of association , it would exists if its containing object is destroyed
What is composition
The containing object is destroyed , the association object is also destroyed ( stronger relationship)
Why is oop used
it provides program with clear structure makes developing and testing easier for developers Allows large projects to be divided among teams of developers it improves the space efficency of code
List the three design principles used in oop
Encapsulate what varies Favour composition over inheritance Program to interface , not implementation
Explain more on encapsulate what vaaries
Any requirement which are likely to change in the future would be encapsulated in a class , this way future changes can be easily made when required
Explain more on favour composition over inheritance
composition has a more flexible relationship by unrelated classes
Explain more on program to interface not implemetation
allow unrelated classes to make use of similar methods