Design Priciples Flashcards
S (in SOLID)
-Single Responsibility-
Class has ownership over only one thing, and everything needed to manage that is in the class
O (in SOLID)
-Open/Closed Principle-
Open for extension, closed for modification. If you want to make a class that overrides a parent in some way that’s ok, but you shouldn’t be able to fundamentally change that parent on the fly.
L (in SOLID)
-Liskov Substitution-
If S is a subtype of T, then an object of S should be able to fill in everywhere T fills. If you’re extending a class it has to do everything the parent could do.
Recursion
Instructions that reference the “same” procedure as part of it’s own procedure.
I (in SOLID)
-Interface segmentation-
Don’t depend on interfaces they don’t use. You’re better off using many small interface than one big one,where not everything is used.
D (in SOLID)
-Dependency Inversion-
High level abstractions should not depend on low level implementations.
Encapsulation
The data/internals of a class are hidden to others
Abstraction
Develop for function not for implementation. Decompose into smaller components.
Inheritance
Child classes take on properties/data from their parents
Polymorphism
Two related classes can implement the same function, but have different results/implementations