问题
Are there any conventions or good practices when naming interfaces for EJBs? I am trying to apply some DDD principles in my application as well so I am using the "service" sterotype on the classes that is the interface for the world outside.
If I have a QuestionService EJB that provides business logic operations to clients, what would the @Local/@Remote Interface be named? All the books I read so far only names them QuestionServiceLocal/QuestionServiceRemote. Is this suffcient (I am not trying to get fancy with naming, but I wonder if there are better naming conventions)?
Also, are the other/better ways of naming the "services" in an application than just adding the "...Service" suffix on each class?
回答1:
Java naming conventions are created and adopted by the community and also by the elder developers in the company.
So every time we are facing naming issues, we can go forward with the following:
- if the project is already there then just follow the project naming coventions
- if this is a new project you're creating then:
a.QuestionServiceLocal
/QuestionServiceRemote
is a very good approach
b.QuestionService
is more than enough for naming a service
来源:https://stackoverflow.com/questions/10065065/standard-conventions-or-good-practices-when-naming-local-remote-interfaces-of-ej