The principles basically are the guidelines for a better software. They are the MAGIC 5, that keeps protecting you while you design the architercture of the application, they are the 5 SOLID ancient golems, if you will. They helps you fight the code smells, due to refactoring. So, let’s check ‘em out:
Single responsibility principle(SRP) - every class or function or any other context should have only one responsibility and that responsibility should be completely encapsulated by the context.
Open/closed principle(OCP) - entity should be open for extension, but closed for modification. It is the safe-explonatory, I suppose.
Liskov substitution principle(LSP) - objects in a program should be replaceable with instances of their subtypes.
Interface segregation principle(ISP) - client of the interface should not depend on methods it doesn’t use. ISP splits interfaces to the smaller ones, so clients will only use methods that are needed.
Dependency inversion principle(DIP) - software module should depend on abstraction, not concrete implementation. In other words, we need to use interfaces as our abstractions and not concrete implementations of these interfaces.