Advantages and disadvantages of Command patterns

The Command pattern has the following advantages:

  • It decouples the classes that invoke the operation from the object that knows how to execute the operation
  • It allows you to create a sequence of commands by providing a queue system
  • Extensions to add a new command is easy and can be done without changing the existing code
  • You can also define a rollback system with the Command pattern, for example, in the Wizard example, we could write a rollback method

The following are the disadvantages of the Command pattern:

  • There are a high number of classes and objects working together to achieve a goal. Application developers need to be careful developing these classes correctly.
  • Every individual command is a ConcreteCommand class that increases the volume of classes for implementation and maintenance.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.27.58