SOLID principles

500

SRP (Single Responsibility Principle)

"A class should have only one reason to change."
- Robert C. Martin

When a class performs one task, it contains a small number of methods and member variables that are self-explanatory. SRP achieves this goal, and due to this, our classes are more usable, and they provide easier maintenance.

OCP (Open/Closed Principle)

"A software artifact should be open for extension but closed for modification."
- Bertrand Meyer

Add new code to improve quickly instead of changing the core code, which should be kept unique and reusable.

OCP can be implemented through inheritance or interfaces. The latter, also known as polymorphic OCP, allows for extension while keeping the original code closed for modification.

To be continued...

Thoughts 🤔 by Soumendra Kumar Sahoo is licensed under CC BY 4.0