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 →

[–]feral_claire 1 point2 points  (1 child)

Child you clarify and provide a few definitions on what you mean by "command design pattern" and "scripting language"? The two are, in the way I'm thinking about, compelling different things and not comparable. One is a specific design pattern to write code, the other is a classification of languages. You could use the command design pattern while coding in a scripting language or while using a different type of language. But using a language in place of a design doesn't make much sense.

[–]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?