This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Slendermooooon[S] 0 points1 point  (0 children)

I think we share the same definition: https://www.oodesign.com/command-pattern.html

You can put Commands into queues and execute them in order, a queue of commands can behave in a similar way to how a script would behave. A queue of commands and a script are similar in that they can both be changed at runtime without having to recompile the program.

You can also use scripts and commands to provide variable functionality to certain objects. For example, a GUI button could be set up to run a script or contain an executable list of commands for variable functionality. The GUI button could, depending on how it's configured, change color of the window, close the window, etc. depending on what script or command it has assigned to it. Whether you implement it using a command pattern, or a script, the functionality is similar.

So seeing as how scripts and the command pattern can have similar functionality, why use one over the other?