Placement of service methods
Posted
by
mhp
on Stack Overflow
See other posts from Stack Overflow
or by mhp
Published on 2011-11-13T17:46:19Z
Indexed on
2011/11/13
17:50 UTC
Read the original article
Hit count: 280
oop
|coding-style
Let's assume I have two service classes with the following methods:
- GroupService
- createGroup()
- deleteGroup()
- updateGroup()
- findGroup()
- UserService
- createUser()
- deleteUser()
- updateUser()
- findUser()
Now, I am thinking about the aesthetics of theses classes. Imagine we want to implement a method which search for all user of a specific group. Which service class is responsible for such a method?
I mean, the return value is a user (or maybe a collection of users) but the parameter (which means the name of the group) is a group. So which service class is the better place to put this method in?
© Stack Overflow or respective owner