SOLID design principles Flashcards

1
Q

what are the solid principles

A
single responsibility
open closed
liskov's substitution
interface segregation
dependency inversion

they are design principles for OOP

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

single responsibility

A

concept of a class doing one specific thing and not trying to do more than it should (high cohesion)

states that every module, class or function should have responsibility over a single part of the functionaility and that responsibility should be entirely encapsulated by that class

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

monster/god class

A

high cohesion - i.e. class is doing too much

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

open closed

A

software entities should be open for extension by closed for modification. can allow behavior to be extended without modifying existing code

add new code without having to change to existing code

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

Liskov substitution

A

ensuring that inheritance is used correctly

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

interface segregation

A

clients should not be forced to depend on methods that they do not use. devs should favor thing interfaces

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

dependency inversion

A

The Dependency Inversion principle states that our classes should depend upon interfaces or abstract classes instead of concrete classes and functions.

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