I’m stuck with figuring out a good naming convention for the service layer in a spring application. For each class in the service layer I first write the interface it should implement and then the actual class. So for example I have the following interface:
public interface UserAccountManager{
public void registerUser(UserAccount newUserAccount);
public void resetPassword(UserAccount userAccount);
...
}
And then the implementation class…
What bugs me here is UserAccountManager is a good name for the implementation class so I’m forced into giving it a stupid name like SimpleUserAccountManager or UserAccountDbManager.
What are some of the conventions you’ve used so far? Is it a good idea to put the implementation classes in a different package and give them the same names as the interfaces?
Also what are your thoughts on using names ending with Manager over names ending with Service?
Spring itself gives interfaces generic names and then names the classes based on the details of the implementation. This is one example that comes in mind:
I don’t think names like SimpleUserAccountManager or UserAccountDbManager are stupid, since they convey some information regarding the implementation of the manager/service.
What I find stupid is the common convention to add the “Impl” suffix at the implementation classes:
Some people prefer this though.