Solid principles
1. S - Single Responsibility Principle (SRP)
class Report {
void generateReport() {
System.out.println("Generating report...");
}
void printReport() {
System.out.println("Printing report...");
}
}2. O - Open/Closed Principle (OCP)
3. L - Liskov Substitution Principle (LSP)
4. I - Interface Segregation Principle (ISP)
5. D - Dependency Inversion Principle (DIP)
Summary of SOLID Principles
Principle
Description
Example Issue
1. Single Responsibility Principle (SRP)
Bad Design (Violating SRP)
Good Design (Following SRP)
2. Open/Closed Principle (OCP)
Bad Design (Violating OCP)
Good Design (Following OCP)
3. Liskov Substitution Principle (LSP)
Bad Design (Violating LSP)
Good Design (Following LSP)
4. Interface Segregation Principle (ISP)
Bad Design (Violating ISP)
Good Design (Following ISP)
5. Dependency Inversion Principle (DIP)
Bad Design (Violating DIP)
Good Design (Following DIP)
Summary of SOLID Principles in Python
Principle
Description
Example Issue

Last updated