command pattern "params"("command ""string "}invoker run(once the function you want to execute gets more complicatedyou have two options other than the method we used in the previous program you could just wrap the command' execute(function in lambdaletting you avoid creating class even though it is nifty trickyour code will probably be more clear if you just create class for the complex casewhich is the second option soa good rule of thumb is that when you need to create command for anything more complex than piece of code you can wrap in single-line lambda functioncreate class for it parting shots whether you are building self-driving car or sending messages to outer spacedecoupling the request for execution from the actual execution allows you to not only buffer actions that need to be executedbut also exchange the mode of input it is important that the command pattern isolates the invoker from the receiver it also separates the time the execution is set up from the time it is processed exercises use the command pattern to create command-line wordreplacement script that can replace every instance of given word in given text file with some other word thenadd command to undo the last replace action