Timeline for Is it bad practice that a controller calls a repository instead of a service?
Current License: CC BY-SA 4.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 6, 2022 at 19:55 | comment | added | amphibient | good question, I just asked the same but on SO, albeit in the context of Spring | |
| S Aug 5, 2021 at 15:52 | history | edited | Glorfindel | CC BY-SA 4.0 | added 34 characters in body; edited title |
| Aug 5, 2021 at 13:01 | review | Suggested edits | |||
| S Aug 5, 2021 at 15:52 | |||||
| Mar 15, 2020 at 20:28 | history | protected | gnat | ||
| Mar 15, 2020 at 17:15 | answer | added | Izhari Ishak Aksa | timeline score: 5 | |
| Oct 18, 2019 at 18:00 | history | tweeted | twitter.com/StackSoftEng/status/1185254387876323330 | ||
| Oct 15, 2019 at 10:33 | answer | added | Rober2D2 | timeline score: 6 | |
| Jan 6, 2019 at 15:57 | comment | added | Mahmoud Hboubati | repositories are stores, lists, it doesn't understand what is going on about the things it carries or has !!! | |
| Jun 30, 2016 at 18:24 | vote | accept | mohsenJsh | ||
| Apr 7, 2020 at 6:41 | |||||
| Jan 8, 2016 at 21:25 | answer | added | Joppe | timeline score: 70 | |
| Jan 8, 2016 at 19:13 | answer | added | Greg Burghardt | timeline score: 18 | |
| Jan 8, 2016 at 19:13 | comment | added | Henrique Barcelos | Maybe you could come up with a generic service that only forwards your request to the repository and then returns. This could be useful to keep a uniform interface and would be simple if in the future you need to add a real service to do something before call the repository. | |
| Jan 8, 2016 at 17:44 | review | Close votes | |||
| Jan 10, 2016 at 12:26 | |||||
| Jan 8, 2016 at 17:30 | comment | added | NikolaiDante | There isn't a hard and fast rule that you should have a Controller -> Service -> Repository structure over Controller -> Repository. Pick the right pattern for the right application. What I would say is that you should make your application consistent. | |
| Jan 8, 2016 at 17:29 | comment | added | Robert Harvey | Meh. If it's a small application and you're just trying to get data from a database, a service layer is a waste of time unless that service layer is part of some public API such as a REST interface. "Is milk good for you or bad for you?" Depends on whether you're lactose intolerant. | |
| Jan 8, 2016 at 17:27 | comment | added | Jimmy Hoffa | I use that design approach myself rather commonly. My controller (or an underlying composer class) will request data from or send data to the repo, and then pass it to any service classes that need to do processing. No reason to combine data processing classes with data retrieval/management classes, they're different concerns though I know the typical approach is to do it that way. | |
| Jan 8, 2016 at 17:25 | comment | added | Robert Harvey | How are you calling the service? Through a REST interface? | |
| Jan 8, 2016 at 17:22 | history | asked | mohsenJsh | CC BY-SA 3.0 |