The command design pattern

This design pattern represents an object that is used to store information about an action that needs to be triggered at a later time. The information includes the following:

  • The method name
  • The owner of the method
  • Parameter values

The client then decides which commands need to be executed and when by the invoker. This design pattern can easily be implemented in Scala using the by-name parameters feature of the language.

Get Scala Design Patterns - Second Edition 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.