|
|
Spring service vs. Webflow Action, how do you choose one?
I'm not quite sure I understand what the criteria is for having the business logic exist in one orthe other. I understand an action is the webflow place to contain business logic, but the spring service seems to be the original location for them.
Say you have to implement the responsibilites of quot;createNewContentItemquot;, quot;updateContentItemquot;, and quot;deleteContentItemquot;. What lives where?
My current guess is that services are essentially data access objects with fine-grained methods. the actions would then call a grouping of these. But if that's the case, then what's the purpose of multi-action, where you could group multiple actions together...
Are Actions supposed to replace services?
Help! hehe.
Thanks in advance.
I have a different view on this matter I guess. The Action is 'just' the Controller part of the MVC paradigm and this should only include logic for the view, call services etc. The business logic would still reside in Services. Which is IMHO the place to put it.
What would happen if you put al your business logic in your Actions and next requirement is to create a Swing client for your application, how are you going to reuse the existing business logic?
I follow Marten's reasoning here.
I understand an action is the webflow place to contain business logic
This is not the intention. The SWF actions are the glue code between the flow (a presentation element) and the services. Like Marten explains, actions contains functionality focused at the flow. Part of this functionality might be calling service methods and possibly manipulating the results for processing by the flow. The code that you see in a SWF action is very similar to the code you would find in a Struts Action or Spring Web MVC Controller.
Erwin
Originally Posted by klr8This is not the intention.
ok, things are clearer now. the webflow reference says to quot;executequot; your business logic here, i probably misread that. next step is to play around with services being injected vs. bean actions to see which one i like better...
thanks for the direction, appreciate it. |
|