struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Ventura <>
Subject Where to put logic for "create or update" stuff?
Date Sun, 01 Jun 2003 20:54:06 GMT
I have a use case in wich a user will be created if its ID is 
null, or updated otherwise. 

What would be the preferrable approach?

a) My business services layer provides both createUser() and 
updateUser(), and I determine wich one to call inside my 
Action (by testing user.getId() ), or:

b) My business services layer provides a saveUser() method 
wich will have the necessary logic inside. This way all my 
Action needs to do is build a User object and pass it to 
the service layer.

I like the second one better. However, I've read that Struts
actions can be considered part of the controller layer; the first
option above does treat the action as a "controller" (there's 
logic in it), whereas option b) considers it to be something more
presentation-bound (almost no logic, simply converts requests 
into objects). 

Are there any advantages/pitfalls to these strategies?

- ventura

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message