Service objects are an important concept in the Ruby on Rails framework, and they are a crucial component of the Model-View-Controller (MVC) archit...
For further actions, you may consider blocking this person and/or reporting abuse
I came from a Java SpringBoot, and it is a common pattern to use.
Now I use Rails and I really love it. Nonetheless I was quite surprised by the difference in the pattern that we use.
At the end of the day, it is really cool to improve your skills by taking what fit you in different language/framework/tech.
absolutely agree with all the benefits you listed. service objects are always present in any ruby app I've seen.
Something I use frequently : turn your method call static =>
Then you can extend your Services :
Then simply do :
Also you can use a payload system or railway pattern to ensure your behaviours. And don't forget unit tests <3
Service Objects are cool, but I prefer writing modular, expressive and sequentially logical ruby code represented by use cases. With a gem like github.com/serradura/u-case we can code in a simple way (input >> process >> output) . Easy to test, easy to maintain and easy to understood. In a big app, Service Objects tends to be a transfer from fat models to fat services.
thank for posting about u-case, it look amazing to me