5 principles in Object Oriented Programming
introduced by Robert C. Martin
Single Responsible Principle
- A class should have single reason to change
- Separate of concern - different classes handle different tasks problem
Open-Close Principle
- Class should open for extension but close for modification
Liskov Substitution Principle
- You should be able to substitute a base type for a subtype
Interface Segregation Principle
- Don’t put too much into an interface; split it into separate interfaces
- YAGNI - You Ain’t Going to Need It
Dependency Inversion Principle
- High-level modules should not depend on low-level one, use instruction