Scala Design Patterns.
上QQ阅读APP看书,第一时间看更新

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.