SOLID Principles

What is SOLID? SOLID is a set of principles that help you write better code. It stands for Single Responsibility Principle Open/Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle Single Responsibility Principle (SRP) SRP states that a class or module should only have one reason to change. This means that a class should only focus on a single well-define task or responsibility. You can think of ‘responsibility’ as the axis of change in your software. If you have more than one reason why your class needs to be modified, you likely have violated SRP. ...

January 20, 2025 · 4 min · 730 words · Wei Sheng