• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about class naming  RSS feed

 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all, probably this question can sound a little bit stupid, but i have the next doubt: I'm doing a webapp using Struts 2, and if you know, in struts 2 you create actions, interceptors, jsp (or some other view technology) and so on. This applies the MVC where View is the view technology like JSP or velocity, Controller is the internal Struts servlets that handle all the requests and the Model are the action classes where you define the application logic when somebody makes a request to Struts Action.

For example if i have a simple CRUD application in my action i can have the methods for update, delete, insert and select. The problem here is that i have to put (consider that i'm not using anything like hibernate or some orm, just JDBC ) all the code with the sql query, statements, resultset and so on inside each action's method. My question is, that to separate that from my actions i want to create classes used by my actions, for example if i have a employees mantainment i have my action EmployeesAction and inside it's methods of insert, delete select and so on i only call the insert method from other class. That "other class" is something like a DAO but i prefeer don't call in that way because i'm not applying the DAO concept at all, so MY QUESTION IS: How can i name those classes? for example if i apply DAO my class could be named like EmployeeDAO, but in my case how can i call it?

Thanks in advance.
 
Mazer Lao Tzu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen these classes called Managers, such as EmployeeManager.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oscar Calderon wrote:Controller is the internal Struts servlets that handle all the requests and the Model are the action classes where you define the application logic when somebody makes a request to Struts Action.

Just for completeness, S2 uses a filter, not a servlet.
in my case how can i call it?

I'm not entirely sure what you're asking, but they might also be called services.
 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, about the filter, i didn't know that. Thanks for the acclaration.

About "in my case how can i call it?" i mean about how to name my classes, as DAO are named EmployeeDAO, SomethingDAO and so on.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've already been given two options, "manager" and "service".
 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks to both for your answers
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!