SOLID Flashcards
Single Responsibility Principle
It states that there can only be one change in the software that could potentially change the specification of the class. This is because a class should only perform one kind of task. This is important to keep in mind because SRP reduces merge conflicts, and incompatibility issues when multiple people are working on the same project and hence makes version control easier.
Open-Closed Principle
The open-closed principle simply states that classes should be open to extension while remaining closed to modification. In simpler words, we should be able to add new functionalities to our class without having to change pre-written code inside of our class.
Liskov Substitution Principle
this states that all extended classes should be able to work using inputs of the type of super class and not produce any bugs while doing it. Although this is the expected behavior, it is often violated.
Interface Segregation Principle
This principle states that we should create multiple interfaces to deal with clients instead of one so that for extended classes which might not need some of the functionalities, the user should not have to deal with them at all. Instead, he/she should have the independence to choose from the possible interfaces.
Dependency Inversion Principle
Closely knit with the Open Closed Principle, Dependency Independence principle states that classes should rely on abstract classes and interfaces and not on rigid concrete functions and classes.