DEV Community

Cover image for I Used to be a 💩 Coder 💻 Until I Re-discovered SOLID Principles 🌟
Yashodhan Singh
Yashodhan Singh

Posted on

I Used to be a 💩 Coder 💻 Until I Re-discovered SOLID Principles 🌟

I remember when I first heard about SOLID principles, I thought to myself "what a load of 💩, who needs that many rules to write good code?" 🤔 Little did I know, it was my code that was 💩. Eventually, those principles became the cornerstone of my development practice and elevated my coding skills tenfold 🚀.

It wasn't until my CTO 🧔 started making "amazing" remarks in code review and explained the value of SOLID principles that I really understood their importance. He showed me how they made my code more maintainable, scalable and easier to understand. And trust me, that's when I really started to see the value in SOLID.

Here's how each SOLID principle leveled up my skills:

Single Responsibility Principle (SRP) 💼
This principle taught me to write code that only has one responsibility, making it much easier to maintain and understand. It's like having a neat and organized workspace, everything has its place and it's much easier to find what you need!

Open/Closed Principle (OCP) 🚪
This principle taught me to write code that can be easily extended, but not modified. It's like having a building that can be added on to, but still remains sturdy and secure.

Liskov Substitution Principle (LSP) 🔗
This principle taught me to write code that is easily interchangeable, like building with LEGOs! It's like being able to switch out parts without affecting the overall structure.

Interface Segregation Principle (ISP) 🌐
This principle taught me to write code that is flexible, allowing me to create interfaces that can be used by different parts of my code without affecting the others. It's like having multiple languages that can communicate with each other!

Dependency Inversion Principle (DIP) 💪
And my personal favourite, DIP taught me to write code that is easily adaptable, by depending on abstractions instead of concrete implementations. It's like having a toolbox that can be used for any job, no matter how complex!

In conclusion, SOLID principles may seem overwhelming at first, but they're worth taking the time to understand. Trust me, your code will thank you! 😊

P.S. 📢 Don't stress about memorizing each principle, even I had to Google them to write this article! But in practice, they've already become second nature to me, like muscle memory 💪. Just keep using SOLID principles in your development and you'll see the benefits for yourself! 💻

Image description

Image description

Top comments (2)

Collapse
 
dsfx3d profile image
Yashodhan Singh • Edited

@andyrosenberg obviously it's not the theory of everything but it does turn me into Golem every now and then.

Collapse
 
andyrosenberg profile image
AndyRosenberg

SOLID is good, but this post reads kinda culty.