DEV Community

Cover image for S.O.L.I.D. Principles Around You

S.O.L.I.D. Principles Around You

Oleksii Trekhleb on March 29, 2020

In this article, I want to briefly go through SOLID principles (the acronym that stands for five basic principles of object-oriented programming an...
Collapse
 
jwp profile image
John Peters

This is the best explanation of SOLID I've ever seen. Just fantastic, kudos Oleksii!

This would be a wonderful read for many Javascript folks because the principals still apply. It started as an OOD thing, but transcends Object Oriented Design/Programming.

I follow this pattern religiously, especially the first two. It keeps monolithic programming far away as a result. That is always good.

Collapse
 
trekhleb profile image
Oleksii Trekhleb

I agree with you John. Sticking to these principles makes code less fragile and easy to manage as well.

Collapse
 
jwp profile image
John Peters

Nice meeting you, I'm adding you to my list to Follow, hope we meet again!

Collapse
 
adamtomat profile image
Adam Tomat

Great article! Love the examples.

Personally I think the DIP example could have been more explicit about “the plug doesn’t care which type of wire it uses, it just needs wires that conduct electricity”

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Good point, Adam! If you don't mind I've just added one more sentence to DIP to reflect the idea from your comment.

Collapse
 
adamtomat profile image
Adam Tomat

Awesome :)

Collapse
 
sanchitsanchu profile image
sanchit gupta

Very easy and unique pictorial representation. This would really help me to memorize the principle with real-world examples. I appreciate your efforts.

I have a request :
Can you publish the article with this same pictorial examples of topic design patterns? I often messed up with each other. This would be a great help for me. Thanks in advance.

Collapse
 
trekhleb profile image
Oleksii Trekhleb

I'm glad that you liked it, Sanchit!

Very good idea about making a similar article about design patterns! I can guarantee that I'll write it any time soon, just because of lacking of time, but let me put it in my ToDo list.

Collapse
 
bennykelly profile image
bennykelly

Hi Oleksii, this is one of the nicest explanations of SOLID I have seen, thank you so much for sharing. I'd love to use these images in a work presentation; however, just want to check that A) you're ok with that and B) what's the best way/your preferred option to credit these images back to you? Thanks again

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Sure, you may re-use these images with the link to the article (dev.to/trekhleb/s-o-l-i-d-principl...) or if it is too long then just use my Twitter link: twitter.com/Trekhleb

Collapse
 
psaillesh profile image
Saillesh pawar

illustration are amazing and easy to understand.
Thanks for sharing (y)

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Cool! Glad to hear that illustrations help!

Collapse
 
nikosdev profile image
Nikos Kanakis

This is the best explanation i have ever read about S.O.L.I.D 👏 👏 👏

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Thanks for such words Nikos!

Collapse
 
mccabiles profile image
Miguel

I never was able to grasp the last three principles (LID), but the concrete examples you gave made everything click into place. I'll be sharing this at work tomorrow, thanks Oleksii! 😁

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Cool! I'm glad that those pictures were clear enough!

Collapse
 
devarjunan profile image
dev-arjunan

Thank you so much for sharing. I understand clearly.

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Cool! I'm glad that it was useful!

Collapse
 
ryry_02 profile image
Ryan (he/him)

This is incredible!! I've always learned these, then forgot them straight away. This is something that will actually stick! Thank you!

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Cool! I'm glad that it was useful for you!

Collapse
 
davidyaonz profile image
David Yao

this is one of the best explaining I have ever got. thanks

Collapse
 
trekhleb profile image
Oleksii Trekhleb

Cool! I'm glad that it was clear

Collapse
 
francescoxx profile image
Francesco Ciulla

Very clean! i have an article about those S.O.L.I.D. principles, too :)

Collapse
 
trekhleb profile image
Oleksii Trekhleb

I like that your's one have code examples, Francesco! Well done!

Collapse
 
alfdocimo profile image
Alfredo Narváez Docimo

Just what I've been looking for, this is magnificent! 💜

Collapse
 
sagar profile image
Sagar

Nice article 🙂

Collapse
 
emdebarros profile image
Em De Barros

Best S.O.L.I.D. article I've ever read. Thank you!