What it is not so good for

Even though, in the long run, the Scala way of implementing the strategy pattern that uses functions could save a lot on code, sometimes it affects readability and maintainability. The fact that the methods could be stored in an object, class, case class, trait, and so on, indicates the fact that different people could prefer different approaches, and this is not always good while working in a big team. Apart from that, the strategy design pattern doesn't have any major flaws as long as it's used in the right way and in the right places.

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.