DEV Community

Cover image for How SOLID is your code? - Introduction
Abhinav Pandey
Abhinav Pandey

Posted on

1

How SOLID is your code? - Introduction

"I don't understand this method. I should ask the person who wrote this."
"Hey! Your change broke the functionality I implemented few days ago."
"It may take some time, we have a merge conflict."
"It was working before. I don't know what happened now."
"I spent the whole day understanding the code."

Sounds familiar? - Sounds like a normal work day?

These are some of the discussions we have had more frequently than we would like to. Not only does it require extra time and efforts to resolve these situations, it even makes it more likely that we won't mind adding to the mess in the future.

The SOLID principles of object-oriented programming were formulated by Robert C. Martin with a purpose

To create understandable, readable, and testable code that many developers can collaboratively work on.

The five SOLID principles are:

  1. Single Responsibility Principle
  2. Open-Closed Principle
  3. Liskov's Substitution Principle
  4. Interface Segregation Principle
  5. Dependency Inversion Principle

Let's look at each principle and understand how they become important in writing well-designed and maintainable applications.

I will divide it into a series of articles so that I can give enough time to each principle and it doesn't become too much to absorb at a time.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay