DEV Community

Chetan
Chetan

Posted on

1

SOLID Principles

S (Single Responsibility Principle):
A Class should have only one responsibility. Ex: User class should have functions only related to users.

O (Open/Closed Principle):
Open for extension but closed for modification. Means create interface and then extend it to new and old classes but don't change the old class.

L (Liskov Substitution Principle):
If class B is a subtype of class A then we should be able to replace the object of A with B without breaking the behaviour. Means subclass should extend the capabilities of parent class not narrow it down (If base class have 3 capabilities/functions then subclass should have at least 3 capabilities/functions).

I (Interface Segmented Principle):
Interface should have only necessary functions for subclasses.

D (Dependency Inversion Principle):
Class should depend on interfaces rather than concrete classes. Means always create an object of the interface.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More