Martin, thank you very much for sharing your knowledge. In my first Struts project, (now i'm about to embark a second one, so i'm thinking of better designs etc), I use one Action for several use cases, I'll try your suggested approach then.
For others, sorry that when I create the new thead by replying from other thread, I forgot to delete the other thread. It's been deleted now. cheers, ~dion~ -----Original Message----- From: Martin Cooper [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 1:52 AM To: [EMAIL PROTECTED] Subject: Re: Advantages/Disadvantages of One Action for each Use Case There are some major advantages to the first option, especially when you're building a large and/or highly customisable application. A couple of examples: * It is much easier to reconfigure your application. without needing to change any Java code. You may think you know which "actions" are related today, and what the flow of your application is, but when requirements change later, it's much easier to just change the config than to have to tear up your Action classes and move things around. * Your struts-config file is much more self-documenting. If you have an Action class that actually handles multiple "actions", then you can't tell from the config file alone which forwards are used by which "actions". Depending on your code, you may have trouble knowing when you can remove a given forward from the config file, since you'd have to check all of the "actions" to see whether or not it is still used. I've developed large Struts applications using both techniques, and I wouldn't go back, now, to overloading one Action class to do multiple things. I saw the comment from someone else about large numbers of classes, and yes, that can happen, but as long as you're organised and make judicious use of Java packages, it's not a problem. -- Martin Cooper "Dionisius Purba" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I was wondering what's the advantage and disadvantage of > creating one Action for each use case, i.e. creating > NewAccountAction.java > EditAccountAction.java > or even with NewAccountFormAction.java > > vs > > AccountAction.java > and inside the AccountAction we can check parameter from the JSP > then execute proper method (i.e createNewAccount, editAccount, etc) ? > > Perhaps the first option is similar to GoF's command pattern. > Thanks a lot in advance. > Dion > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]