When to user controller vs service? #2376
Unanswered
obrunsmann
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys :)
So there is a technical difference between controller and service, and I am not quite sure, which to use when? Personally, I do it something like that:
Service:
For global things like an IapService, TrackingService (event tracking abstraction), DatabaseService, LocalSettingsService and so on.
Controller:
Feeding views with data and controlling business logic of specific views. Like an ProfileController which gets injected opening my profile.
--
But then, there are several cases where I start to mix this up. Like on a global
AuthServicewhich could also be anAuthController.Besides the personal architecture, are there any recommendation when to extend which class?
Regards :)
Beta Was this translation helpful? Give feedback.
All reactions