SOLID Flashcards

1
Q

How do you spot DIP violations?

A

Does class depend on concrete objects?
Are you instantiating a concrete object in the constructor?

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

What technique does the DIP often use to fix issues?

A

Dependency injection

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

What is dependency injection?

A

In software engineering, dependency injection is a programming technique in which an object or function receives other objects or functions that it requires, as opposed to creating them internally.

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

What are the main benefits to the DIP?

A

Protect code by making it independent of elements that are fragile/unstable(concretions)
Components are loosely coupled (open to extention, closed for modification)
Testing is easy

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

What does it mean to depend on details

A

To depend on concrete objects. Owning an instance of a class

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

What are common problems associated with breaking the DIP?

A

Depending too much on concrete objects

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

How to we fix DIP violations?

A

We want to implement abstractions/interfaces in between classes that depend on concretions.

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