OOP principles Flashcards

1
Q

What are the five SOLID principles?

A
  1. Single Responsibility Principle
  2. Opened Closed Principle
  3. Liskov Substitution Principle
  4. Interface Segregation Principle
  5. Dependency Inversion Principle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly