My alternative to the DCI principle

Hello,

In the DCI principle, I like the Roles. It enable to have a skinny model
with a single responsability (the persistence of the data).

I don’t like the context. It can be useful for some specific cases like
in
this article :
http://mikepackdev.com/blog_posts/24-the-right-way-to-code-dci-in-ruby.
But
I don’t want to have something like this :
https://github.com/randx/rails-dci-example/blob/master/app/controllers/documents_controller.rb.
It’s too complicated for nothing.

I have an alternative here : My way to use services objects · GitHub. It
use service objects with roles. I think it’s the best of both worlds.

What do you think?

guirec c. wrote in post #1111167:

Hello,

In the DCI principle, I like the Roles. It enable to have a skinny model
with a single responsability (the persistence of the data).

I don’t like the context. It can be useful for some specific cases like
in
this article :
http://mikepackdev.com/blog_posts/24-the-right-way-to-code-dci-in-ruby.
But
I don’t want to have something like this :

rails-dci-example/app/controllers/documents_controller.rb at master · dzaporozhets/rails-dci-example · GitHub.

It’s too complicated for nothing.

I have an alternative here : My way to use services objects · GitHub. It
use service objects with roles. I think it’s the best of both worlds.

What do you think?

This sums up what I think better than I could ever explain it myself:

Count me out as a fan of service objects.