SOLID Flashcards

1
Q

S

A

Single Responsibility
“A class should have only one reason to change” which means every class should have a single responsibility or single job or single purpose

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

O

A

Open/Closed Principle
“software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification” which means you should be able to extend a class behavior, without modifying it.

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

L

A

Liskov’s Substitution Principle:
It states that objects of a derived class (subclass) should be able to replace objects of the base class (superclass) without affecting the correctness of the program. In other words, if a class B is a subclass of A, then objects of B should be able to be used wherever objects of A are expected, without causing errors or unexpected behavior.

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

I

A

Interface Segregation Principle:
It states that no client should be forced to depend on methods it does not use. In simpler terms, an interface should be small and specific to a set of related actions, rather than one large interface with many unrelated methods.

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

D

A

Dependency Inversion Principle:
It states that high-level modules should not depend on low-level modules; both should depend on abstractions
Example - Notification (high) and Email (low) service

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