Design Patterns SOLID Principles Single Responsibility Principle Each class should have only one responsibility or reason to change. narrow down the behaviour a class can have Open-Closed Principle Software entities should be open for extension but closed for modification. to add new functionality to a class without changing the existing code by extending a class and adding new functions into subclass Liskov Substitution Principle Objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. a subclass should behave like its superclass, and any methods that the superclass has should also be valid for the subclass if 2 classes implement the same interface, these 2 classes should be interchangable without breaking anything Interface Segregation Principle Clients should not be forced to depend on interfaces they do not use. If there is an interface that defines 5 functions and we only need 2 functions to implement, don’t implement this interface. Instead, seperate the interface for their own purpose. Dependency Inversion Principle High-level modules should not depend on low-level modules. Both should depend on abstractions. don’t define the parameter as a class; instead, define an interface it would be easy to be tested by passing a test class that implements the interface