March 2018
Intermediate to advanced
244 pages
6h 10m
English
Sometimes, adopting a new language means letting go of features that you’ve grown to depend on. Even though Elixir decouples the concepts of data, behavior, and time, you still may argue in favor of other OO concepts like polymorphism. For example, in the previous section, we wrote this code:
| | URI.parse(url).path.split("/").last |
We argued that .split("/").last may be a source of confusion since we don’t know where methods like split come from. You might counter “It’s not a bug; it’s a feature.” In some situations, you don’t actually care which object has the function; you only care that it knows how to split("/"). That’s polymorphism.
It’s our position that polymorphism is an essential mechanism for designing applications. You ...
Read now
Unlock full access