| Author |
Command Pattern for MVC web based
|
Pawanpreet Singh
Ranch Hand
Joined: Jun 12, 2005
Posts: 264
|
|
I am working to make a design for developing a command pattern in MVC web based application. I am using an ActionFactory whose static method is called from ServletController. Am i doing right. Should i use static method or do i create a one time object of ActionFactory in ServletController and call it non-static public method for getting the Action per request basis. Also could you please let me know that is command pattern(behavioural) same as Factory Pattern(creational)?
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
I like this kind of thing a lot. I use something like: This uses a static method, which is pretty common. Folks interested in maximum flexibility and testability avoid hard-coded class dependencies like CommandFactory and static methods, but that's general OO theory not specific to this problem. If you want to dig into that topic, scroll down to the OO, UML, etc. forum. Here are some options ... I left out casting and exceptions and such for brevity ...
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Pawanpreet Singh
Ranch Hand
Joined: Jun 12, 2005
Posts: 264
|
|
|
Thanks a lot, James
|
 |
 |
|
|
subject: Command Pattern for MVC web based
|
|
|