Chapter 24. Command

Polymorphism lets you encapsulate a request, or a command as an object: Establish the signature of a method to call, and vary the effect of calling the method by varying the implementation. The COMMAND pattern establishes a method signature, most often execute() or perform(), and lets you define various implementations of this interface. This lets you encapsulate a request as an object, so that you can parameterize clients with different requests, queue, time, or log requests, and require companion operations, such as undo().

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.