views:

33

answers:

1

What is a good naming convention for multi-layered services and DAOs in a multi-tier applications?

In most of our application we have two layers of services, where the top level services use either DAOs or lower-level services for persistence and other tasks.

Both the top-level services and lower-level services end with "Service" in the simple name and the DAOs with "DAO".

Here is an example in UML form. CustomerService is a top-level service, ImageService a lower-level service and CustomerDAO a DAO.

alt text

The strict division is necessary in most of our applications because the top level services return DTOs to be used in DWR services or MVC web views. Lower level services do not have such constraints as they are not directly exposed to the View layer in MVC usage.

Also lower level service invocations are sometimes used in open transactions or (Hibernate/JPA) sessions.

What would be a good suffix for the the lower-level services to have them separated from the top-level services?

+1  A: 

I don't know if it's the best name, but for the top-level services we use "Worker" as a suffix.

Colin Hebert
CustomerService would be then WorkerCustomer or WorkerCustomerService?
Timo Westkämper
oops, I meant suffix. For example CustomerWorker
Colin Hebert
Thanks for the suggestion, but I associate Worker with threading, so I will still wait for a better suggestion.
Timo Westkämper
Maybe in your case the top-level is more like a Helper. http://java.sun.com/blueprints/corej2eepatterns/Patterns/ViewHelper.html and you could use "Helper" as a suffix.
Colin Hebert
In our case he top-level Service is the actual business service and the lower level services offer supplementary functionality that is not bound to certain business use cases, but for other use cases Helper would be a good suffix I guess
Timo Westkämper