Hello Boris,
I think that the command pattern is generally used to write aside
the list of commands being taken, so you can make some use of it later
on, For example in the case of UNDO.
I currently can not see any situation like this in the future, so I
can not see the need for implementing this pattern.
Moreover, if I will work this way, I will have to build up to X
commands lists to X customers....
If I will use command arguments, they will be accesible for every
customer. Isn't it an advantage?
Boris Stumm :
> > I am writing a command line application which in general deals with
> > getting input from sockets and passing it to DB, archiving it etc.
[quoted text clipped - 22 lines]
> a structure that is well-known to others and approved? And the command
> pattern has not necessarily something to do with undo.
Boris Stumm - 31 May 2007 13:00 GMT
> I think that the command pattern is generally used to write aside
> the list of commands being taken, so you can make some use of it later
[quoted text clipped - 7 lines]
> If I will use command arguments, they will be accesible for every
> customer. Isn't it an advantage?
I am not sure if I understand you right, but let me try ;)
Your current alternatives are:
1) Control the application by command line parameters (your preferred
solution)
2) Give the user a menu and a prompt where he has to enter the commands
he wishes to be executed.
This choice has nothing to do with the command pattern. The command
will be the same, and with the command pattern, you'll probably
encapsulate each command in its own class. If this command is executed
because the user pressing some button, or because of some command line
arguments, does not really matter.
And if you want to constrain the commands visible to a customer, you
just could put a .properties file where for each command it is specified
if it is enabled or not.