SuperXtra / NotepadApi

0 stars 0 forks source link

Maybe try use verb based services #12

Open patrykcelinski opened 4 years ago

patrykcelinski commented 4 years ago

https://github.com/SuperXtra/NotepadApi/blob/be211e4f50aaee61a7bcfeb548bd2376fccf6aa6/app/services/UsersService.scala#L19

At work, we have recently such trend/fashion that we call services using verbs e.g. UpdatePassword, RegisterUser, MakeNote, GetMyNotes (...Service in the name is optional, basically the fact that they are in service package is good discriminator). Then you use them like: RegisterUser.register(user), MakeNote.create(note), GetMyNotes.get(userId).

It is good because it makes you write really tiny services that have only one purpose and it seems to be more modern than CRUD based Services where you have UserRepository->UserService->UserController where service supports all CRUD operations. Think about this.