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.
My name is Matteo and I'm a cloud solution architect and tech enthusiast. In my spare time, I work on open source software as much as I can. I simply enjoy writing software that is actually useful.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.