The pimp my library design pattern

In our daily job as developers, we often use different libraries. They, however, are usually made to be generic and allow many people to use them, so sometimes we need to do something extra that is specific to our use case in order to make things work properly. The fact that we cannot really modify the original library code means that we have to do something different. We have already looked at the decorator and the adapter design patterns. Well, pimp my library achieves something similar, but it does this in the Scala way and some of the extra work is given to the compiler to deal with.

The pimp my library design pattern is really similar to extension methods in C#. We will see some examples in the following ...

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.