Design Principles / Patterns Flashcards
What are the 5 Solid principles?
- Single-responsibility principle: “Every class should only have 1 responsibility”
- Open-closed principle: “Classes should be open for extension but closed for modification”
- Liskov substitution principle: “Methods that use references to superclasses must be able to use subclass objects without knowing it”
- Interface segregation principle: “Many client specific interfaces are better than one general purpose interface”
- Dependency inversion principle: “Depend upon abstractions, not concretions”
What is inversion of control?
Inversion of control is a design principle which states that objects should be created and managed by a framework
True or False
Once the first layer is debugged, its correct functioning can be assumed while the second layer is debugged, and so on. If an error is found during the debugging of a particular layer, the error must be on that layer, because the layers below it are already debugged. Thus, the design and implementation of the system are simplified
True
True or False
A monolithic system is tightly coupled whereas a layered system is losely coupled. Layer 0 is the layer that is closest to hardware and layer n is the user
True