Whenever a Command is requested, the Command Factory creates it.
Decoupling of Command creation and Command execution
When a Command object is requested, the Command factory creates it and returns it to the requesting object.
If OpenCAGE is running in GUI Mode, the requesting object is an Action Listener. The Action Listener listens to GUI events and knows the connection between GUI events and Commands. After the Command is created the Action Listener puts it into the Command Pipeline (the Section called Command Pipeline).
If OpenCAGE is currently executing a script, the requesting object is an Execute_Script object.
Depending on GUI Mode / script execution, the Command Factory creates different configured Command Objects. As a part of the creation process, the Command Factory creates and links the appropriate instances of The FET pattern: data source, data gate, data drain (the Section called The FET pattern: data source, data gate, data drain in Chapter 9). For more information look at Example (the Section called Example).