No more Struts in services layer
Yesterday, I did some more refactoring on AppFuse and got rid of Struts in AppFuse's services layer. Basically, I was using business delegates (a.k.a. Managers) to convert POJOs -> ActionForms and vise versa. So now the question is - why do I even need Managers and why don't I just talk directly to DAOs (as most sample webapps do)? I think the best justification is that Managers can be used by rich client apps and it abstracts the DAO implementation a bit more.
The question is - is there any point to using Managers in a webapps that will always be webapps (no rich client)? To be honest, probably not - but it does make for easy testing of the business logic. The main reason I did a Struts-purge is to get ready for adding other MVC options - most of which allow me to use POJOs in my view. I'm looking forward to adding Spring and WebWork support and I'm willing to bet these solutions will be a bit cleaner. Unfortunately, neither of these frameworks offer client-side validation support, but the good news is it's coming.
The best part about yesterday's refactoring? I ended up deleting more code than I added - which is always a good thing.
Posted by Mike on March 18, 2004 at 08:14 PM MST #
Posted by Unknown on March 18, 2004 at 08:15 PM MST #
Posted by Francisco Hernandez on March 18, 2004 at 08:40 PM MST #
So the services do serve a purpose, though perhaps some services will just be invoking the JDBC layer and could be inlined or built with code generation?
Posted by Koz on March 18, 2004 at 08:50 PM MST #
Posted by Jason Carreira on March 18, 2004 at 11:05 PM MST #
Posted by Damien Bonvillain on March 19, 2004 at 07:07 AM MST #
Posted by Jason Carreira on March 19, 2004 at 08:12 AM MST #
Posted by Neil Weber on March 19, 2004 at 11:16 AM MST #
Posted by SÃ©bastien Pouillet on March 19, 2004 at 12:12 PM MST #
So you removed code from AppFuse. Does that mean that users of AppFuse will have to write more code when they use Struts?
"The question is - is there any point to using Managers in a webapps that will always be webapps (no rich client)?"
Don't know enough about AppFuse or Struts, but have you tried to take a webapp and convert to rich client before? Are you *sure* that a webstart rich client could *never* take the place of a webapp? Plus, why does it have to take it's place, why not have both for some apps? Just a few curiosity questions...
Posted by gerryg on March 19, 2004 at 12:39 PM MST #
However, the mainframes we interact with are typically performing services for us, with their own business rules. authorisePayment 2003548, send the customer a letter confirming modifications to their agreements. It just seems that cramming that behaviour into a getData/saveData style of interaction is wrong, but it certainly would be possible.
Posted by Koz on March 19, 2004 at 12:53 PM MST #
Gerry - I did remove code from AppFuse and No - users should end up writing less code than before. I used to have a "convert(Object)" method in my BaseManager class and that's now in BaseAction - so it's the same stuff in a different place. To see precisely what changed - here's the diff for UserManagerImpl.java and the diff for UserAction.java. UserManagerImpl became much simpler and UserAction refers to User (the POJO) in most cases, rather than UserForm (the ActionForm). IMO, it's much cleaner and simpler than before - and I wonder why I didn't do it this way a long time ago.
Thanks to all for the great feedback.
Posted by Matt Raible on March 19, 2004 at 12:55 PM MST #
Posted by James A. Hillyerd on March 19, 2004 at 04:08 PM MST #
Posted by Damien Bonvillain on March 19, 2004 at 07:09 PM MST #
Posted by Vic on March 20, 2004 at 11:02 AM MST #
Posted by sudhir nimavat on January 10, 2007 at 03:52 AM MST #