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)?
Joined: Jan 29, 2003
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