Here, read the intro of the Wikipedia page for Command pattern with me:
In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time.
You know what I call this? A function.
This information includes the method name, the object that owns the method and values for the method parameters.
Here’s your command:
const command = () => object.method(arg1, arg2);
// or in PHP, or in Rust, or in C++...
Every time I hear about a design pattern I don’t recognize, I get afraid that I’m missing some crucial idea, and then I Google it and find out that I’ve been unknowingly using it since I started programming. Yeah, bro, I used the data store pattern earlier today (a variable).