DEV Community

Discussion on: Effective Service Objects in Ruby

Collapse
 
matteojoliveau profile image
Matteo Joliveau • Edited

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.