Question

I have a Java web application built using Spring MVC. I have a set of JSPs which are the pages, and a set of "model" objects which are sent to the JSPs to populate/receive the form data. Here is a simplified view from the JSP down to the database layer:

showCustomer.jsp  // JSP page using the "CustomerViewDao"
org.mycompany.views.CustomerViewDao  // view backing (model) object
org.mycompany.controller.CustomerController // controller layer
org.mycompany.service.CustomerService // service layer
org.mycompany.model.Customer // Hibernate entity

Is there an accepted naming convention for these model objects? I chose "xxxDao" for "Data Access Object" and was told this was not a "good" choice. Is there a better choice and what would it be?

Was it helpful?

Solution

Firstly, there is no "accepted naming convention". However, some people have good ideas about these things ... e.g. trawl through the answers to this: What naming convention do you use for the service layer in a Spring MVC application?

For what it is worth, I probably would have chosen xxxDao too ... assuming that the object really is a DAO. But obviously, your reviewer had different ideas. You should ask him (or her) for suggestions ... not us! (What is to say that he won't arbitrarily reject your next N choices as being "not good"?)


On the other hand, he might have rejected your choice of "xxxDAO" because the object / class is not a DAO (Data Access Object) in the normal sense of that term. Your description ... "view-backed (model) object" ... does not really match the normal usage of DAO.

OTHER TIPS

I had called it: ShowCustomerBean

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top