DEV Community

Discussion on: Rails and the Single Responsibility Principle

Collapse
 
teckden1 profile image
Denys

Thanks for the article, and here is my 2 cents

In this scenario having a service object for getting a data is not friendly.
It would be hard to remember to look into the service objects, when we want to understand the domain model context

The main question is why do we need this short_summary in the first place? Is this only for the view part? Or we need it to be a strong part of the domain model context? Answering that question will lead us to few possible solutions:

  • if it is something required for the view, then we need a ViewModel which would be some sort of the decorator for the current domain model
  • if it is important to have the 'short_summary' data as part of the domain model then it should definitely have its own column

I think service objects serve a bit different purpose, but I'm opened for the discussion :)