1) Single-use Modules are probably better off as Classes as per the below article.
https://www.cloudbees.com/blog/when-to-be-concerned-about-concerns
By and large, maintainers tend to agree that smaller composable classes are the best way to isolate code and keep things clean.
....
....
I'm not saying that you need to go out and refactor all your single-use modules into classes. I am saying if you find yourself reaching to do a module-method extraction, stop. Consider what road you're starting down and these lessons I've shared. What would a class-based extraction look like instead?
2) https://blog.appsignal.com/2020/09/16/rails-concers-to-concern-or-not-to-concern.html
3) https://api.rubyonrails.org/v5.0/classes/Module/Concerning.html
4) https://scoutapm.com/blog/rails-concerns - sort of consolidates content from the above articles
No comments:
Post a Comment