Scala alternatives

This design pattern can also be achieved using different approaches. The fact that we use object composition to pass a factory to our class indicates that we can do something else—we can simply pass a function, just because in Scala they are a part of unification and they are treated the same way as objects.

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.