The SOLID principles are a set of software design principles, that help us to understand how we can structure our code in order to be robust, maint...
For further actions, you may consider blocking this person and/or reporting abuse
When reading about the SRP, I see a conflict in how it is being described here versus how uncle Bob describes it in his book, "Clean Architecture"
"Of all the SOLID principles, the Single Responsibility Principle (SRP) might be the least well understood. That's likely because it has a particular inappropriate name. It is too easy for programmers to hear the name and then assume that it means that every module should do just one thing.
Make no mistake, there is a principle like that. A function should do one, and only one, thing. We use that principle when we are refactoring large functions into smaller functions; we use it at the lowest levels. But is is not one of the SOLID principles – it is not the SRP" - Uncle Bob
In the book mentioned, Uncle Bob defines it:
"A module should be responsible to one, and only one, actor"
With an actor, he mentions that it refers to one or more people who requires a change.
I really like that you are writing about SOLID and sharing. Thank you for that. I would like to hear more about your reasoning here regarding SRP.
Cheers.
Hey, in your example of S, good to see clear example of responsibilities conjunction, where you follow also D principle:
What is the purpose of example in I:
Dear Dmytro,
Thank you for noticing, the example in "I" has been revised.
But the intent was to just show the purpose of the principle, not the concrete implementation, which is lacking of course! As the validation method is just loggining a string :)
Hey, this was nice to read. Good for my ego. Did you come up with this SOLID JavaScript or is this a common term on the web?
It's a 20 year old concept made popular by "Dr. Bob" (i.e. the agile programming disciple Robert Martin of "Clean Code" fame) that was very widely disseminated in the first decade of the so called "software craftsmanship" movement. en.wikipedia.org/wiki/SOLID
A fairly widespread concept. Thanks for the feedback
I had never heard of this SOLID thing but arrived at exactly the same conclusions and methods myself so that is always nice to discover.
Nice post with good examples.
Thank you
Nice examples, but I think the "L" of lisvok is useless if you don't work in JS using OOP.
Thank you. The important part is to grasp the concept.