DEV Community

loading...
Cover image for How SOLID is your code? - Introduction

How SOLID is your code? - Introduction

abh1navv profile image Abhinav Pandey ・1 min read

"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.

Discussion (0)

pic
Editor guide