re: Effective Service Objects in Ruby VIEW POST


I used Service Objects in my last project with the same gem simple_command, that was a beautiful experience. And it helps me find bugs more quickly. In your approach, you split the code in a better way. I think it gives more control on the code base. As the code base grows, you will have less pain to maintain it.
Thanks for sharing.


I tend to use commands only for small tasks like creating/updating/filtering models, and not for full-fledged services because it leads to an incredible proliferation of classes. If you have 4 different models and you implement the basic CRUD commands for each of them, you end up with 16 different classes. Aggregating them in service modules and using those in your business code allows for more clarity and consistency (you know that all the user-related functionality lives inside UserService etc) while leveraging your 10s of small commands under the hood.

code of conduct - report abuse