S — Single Responsibility Principle (SRP)
O — Open/Closed Principle (OCP)
L — Liskov Substitution Principle (LSP)
I — Interface Segregation Principle (ISP)
Clients should not be forced to depend on methods they do not use.
//Bad Example
interface Worker {
void work();
void eat();
}
A robot doesn't eat.
Good Example
interface Workable {
void work();
}
interface Eatable {
void eat();
}
Classes implement only the interfaces they need.
D — Dependency Inversion Principle (DIP)