In the previous section, we saw how to write event handlers for user interface components. This works great in small applications, but for larger projects, such hardwired connections between the UI and code leads to a pretty big mess. A solution is to separate the user interface from the actual code and connect them with a command pattern.
Note
Chapter 6, Nullable Object, Template Method, Command, and State, discusses the command pattern in more detail.
As you are programming with Delphi, you're in luck. There's no need to write the complicated infrastructure that's required for the implementation of a command pattern as Delphi already implements this pattern in the form of actions.
In Chapter 6, Nullable Object, Template Method, Command, and State, I wrote about four important parts of any command pattern:
"A command is an action, wrapped inside an object. It is created by the client object, for example, as a response to the user input. When a command is executed, it operates on a target...