Use use

Elixir behaviours are fantastic—they let you easily inject functionality into modules you write. And they’re not just for library creators—use them in your own code to cut down on duplication and boilerplate.

Although behaviours let you add to modules that you are writing, you sometimes need to extend the functionality of modules written by others—code that you can’t change. Fortunately, Elixir comes with protocols, the subject of the next chapter.

Get Programming Elixir 1.3 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.