i am woring with a struts application.
like add a employee and edit the employee and delete the record like.
is it better to write one action class for all of the above actions or
to write individual actions for individual ones..
clearly tell me the relation between the performence and the number of action classes
by
-
which one is better?? (4 messages)
- Posted by: Maruthi Ram
- Posted on: April 06 2004 04:36 EDT
Threaded Messages (4)
- which one is better?? by Mircea Crisan on April 06 2004 06:23 EDT
- Which is better by Wade Robbins on April 06 2004 17:16 EDT
- Which is better by Jirawat Uttayaya on April 07 2004 21:15 EDT
- Which is better by Wade Robbins on April 07 2004 09:48 EDT
- Which is better by Jirawat Uttayaya on April 07 2004 21:15 EDT
-
which one is better??[ Go to top ]
- Posted by: Mircea Crisan
- Posted on: April 06 2004 06:23 EDT
- in response to Maruthi Ram
Hi,
Yous should user one form (EmplyeeForm) and more actions (AddEmployeeAction, EditEmployeeAction, GetEmployeeAction, DeleteEmployeAction). Extracting common logic in a BaseEmployeeAction might improve things.
Best regards,Mircea -
Which is better[ Go to top ]
- Posted by: Wade Robbins
- Posted on: April 06 2004 17:16 EDT
- in response to Maruthi Ram
Hi,
Personally I would use one form but use DispatchAction or Lookup Action and only have one Action class. That way your code that is commonly used is in one place instead of the Action class with only execute method. -
Which is better[ Go to top ]
- Posted by: Jirawat Uttayaya
- Posted on: April 07 2004 21:15 EDT
- in response to Wade Robbins
Like Mircea, I prefer one Action class to do one thing and one
thing only. You can put common stuff in a Base Action class as
suggested.
I'm not a big fan of the one Action class that does everything.
It almost strikes me as the Magic Servlet anti-pattern.
To each his own I guess.
Jirawat Uttayaya -
Which is better[ Go to top ]
- Posted by: Wade Robbins
- Posted on: April 07 2004 21:48 EDT
- in response to Jirawat Uttayaya
Well, I disagree with that because you don't write a bean that simply gets your property. The action class should be within a simple business domain. CRUD (Create, Read, Update, Delete) operations all fall under one operation on an object. You don't create a different database object to read, one to update and one to delete.
The multiple Action class thing that does CRUD operations just leads to more classes to maintain for no reason. But then again I'm not a believer in the Base Action either.