Principles Flashcards
1
Q
Don’t Repeat yourself
A
Every piece of knowledge should have a single unambiguous representation in the system.
2
Q
Single Responsibility Principle.
A
Class should have only 1 reason to change
3
Q
Law of Demeter.
A
Law of multiple dots. Do not entangle a method with another objects’ dependencies.
4
Q
Tell Don’t Ask.
A
Tell object what should be done rather than querying objects.
5
Q
Composition over inheritance.
A
Prefer composition unless inheritance is strongly needed.
6
Q
Open/Closed Principle.
A
Software entities should be open for extension but closed for modification.
7
Q
Dependency Inversion Principle.
A
High-level modules should not depend on low-level modules. Both should depend on abstractions