SOLID Design Pattern Flashcards

1
Q

What does SOLID Stand for?

A

S - Single Responsibility
O - Open/Closed Principle
L - Liskov Substitution
I - Interface Segregation
D - Dependency Inversion

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

Define what the Single Responsibility Principle stands for

A

Following this principle means that each class only does one thing and every class or module is responsible for one part of the software’s functionality

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

Define what the Open/Closed Principle stands for.

A

“You should be able to extend a class’s behavior without modifying it.”

Your class complies with this principle if it is:

  1. Open for extension, meaning that the class’s behavior can be extended; and
  2. Closed for modification, meaning that the source code is set and cannot be changed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define what the Liskov Substitution Principle stands for.

A

By following this principle you adhere to the following rule:

If for each object O1 of type S there is an object O2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when O1 is substituted for O2 then S is a subtype of T.

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