SOLID Flashcards

1
Q

What is the “S”?

A

Single Responsibility Principle

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

What is the “O”?

A

Open/Closed Principle

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

What is the “L”?

A

Liskov Substitution Principle

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

What is the “I”?

A

Interface Segregation Principle

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

What is the “D”?

A

Dependency Inversion Principle

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

Benefits of Single Responsibility Principle

A

It makes your software easier to implement and prevents unexpected side-effects of future changes.

Also, classes, software components and microservices that have only one responsibility are much easier to explain, understand and implement than the ones that provide a solution for everything.

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

What is Single Responsibility Principle

A

A class should have one, and only one, reason to change.

Each class, software component, and microservice is responsible for one, and only one, thing.

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

How can Single Responsibility Principle be overused

A

A lot of classes with only one function can lead to many dependencies.

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

What is Open/Closed Principle

A

“Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.”

Write your code so that you will be able to add new functionality without changing the existing code.

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

Polymorphic Open/Closed Principle

A

Utilizes interfaces instead of superclasses to allow different implementations which you can easily substitute without changing the code that uses them. The interfaces are closed for modifications, and you can provide new implementations to extend the functionality of your software.

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

Benefits of Open/Closed Principle

A

Interfaces allow for modifications of the dependencies without changing the main app.

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

Liskov Substitution Principle

A

“Let Φ(x) be a property provable about objects x of type T. Then Φ(y) should be true for objects y of type S where S is a subtype of T.”

Objects of a superclass shall be replaceable with objects of its subclasses without breaking the application.

Extends the Open/Closed Principle by focusing on the behavior of a superclass and its subtypes.

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

Interface Segregation Principle

A

“Clients should not be forced to depend upon interfaces that they do not use.”

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