What it is good for

The strategy design pattern helps us when we want to be able to change implementations at runtime. Also, as we can see, the implementations live separately from the code that uses them, so it's quite easy to add new ones without the risk of introducing bugs in other parts of our system.

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.