I have great experience in IT over 12 years: front / back - ends, mobile, system administration and deployment cycle. I implement effective and great software products.
Hey, in your example of S, good to see clear example of responsibilities conjunction, where you follow also D principle:
// processvalidateRequest=(req)=>isValidForm(req)&&createUser(req)//Call an external function to validate the user formisValidForm=(req)=>testForm(req.name,req.password,req.email)//Only Create User in the DatabasecreateUser=(req)=>User.Create(req.name,req.password,req.email)
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 :)
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.
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
Grumpy old fart that throws up a little every time he sees someone being passionate about some javascript lib. Tech agnostic. If it bleeds, I can kill -9 it.
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
Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.
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 :)
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.
Nice post with good examples.
Thank you
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 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.