The Command pattern is a Gang of Four behavioral design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time. When using this tag on implementation heavy questions - tag the code language the implementation is written in.
The Command pattern is a Gang of Four behavioral design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time.
The object used includes the method name, the object that owns the method and values for the method parameters.
Typical uses of the Command pattern are, among others:
- Undo
- Transactional behavior
- Wizards
- ThreadPools
This is one of the Gang of Four's behavioral design-patterns, first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".