OOP principles Flashcards
1
Q
What are the five SOLID principles?
A
- Single Responsibility Principle
- Opened Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
2
Q
What does The Single Responsibility principle say?
A
A class should have one and only one reason to change, meaning that a class should only have one job.
3
Q
What does the Open-closed principle say?
A
Objects or entities should be open for extension, but closed for modification.
You should able to add new features to the object without breaking it.
We should not introduce breaking changes to existing functionality
4
Q
What does Liskov substitution principle say?
A
a subclass should override the parent class methods in a way that does not break functionality from a client’s point of view