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

The state design pattern

This design pattern is similar to the strategy design pattern, and it uses a state object to encapsulate different behavior for the same object. It improves the code's readability and maintainability by avoiding the use of large conditional statements.