SOLID is a mnemotechnic acronym defined by Robert C. Martin, (popularly known as Uncle Bob) for five design principles created to make software designs more maintainable, understandable, and flexible.

These principles, when combined, make it easy for a developer to build software that is easier to extend and maintain. They make it easy for developers to refactor code and avoid code smells. It’s an essential part of modern agile software development, and it is crucial to know and apply them if you want to develop quality and easy to maintain software.

We have a lot of information on the internet about them but less when you try to apply them in javascript. On the other hand, almost all the examples I have found repeat the same cases, and sometimes they are not easy to understand intuitively.

The 5 SOLID principles of software application design are:

S — Single Responsibility Principle (SRP)

O — Open/Closed Principle (OCP)

L — Liskov Substitution Principle (LSP)

I — Interface Segregation Principle (ISP)

D — Dependency Inversion Principle (DIP)

In this article of a series that I am going to write with the five principles, I’m going to talk about one of the principles that seem to be more relevant to me: The Dependency Inversion Principle or DIP and how to achieve it in JavaScript.

#programming #coding #javascript

Decoupling code in JavaScript with the Dependency Inversion Principle
5.40 GEEK