|
|
|
|
|
by yebyen
2651 days ago
|
|
That's common in Rails too. Except I don't think it's necessary to make it a go-between. Where controllers have simple interactions with models (which represent database structures, and may have logic in them) you let the controller have direct access to the model. Models can grow to be too complex, this is where having a concept of named "Concerns" can come in handy, even if you won't use them in another model, it can lift some complexity out of your model and put it into a logical group. Services, in my view, are akin to models. Some of them may use models behind the scenes. More of them actually represent an external service, which might be an external database that lives behind a web service, an API. Or it might be an LDAP service. (Or it might be a command pattern) I agree with smart models, if the complexity does belong to the model, then why not let it live there. It sounds like the service layer you're describing is a needless ceremony for "managing complexity" – I'll bet it was a concept that was introduced to your group by an architect. |
|