4 ms·
I’ve been using elixir for about a year now. It really makes writing API code joyful. The pattern matching concept works so well for handling the variation th
by nivenhuh 7y ago
I’ve been using elixir for about a year now. It really makes writing API code joyful.
The pattern matching concept works so well for handling the variation that happens in API request handling.
I also love working with Plugs. The pipeline nature of elixir translates directly into how you manage a request/response, and the plug abstraction pattern allows you to be explicit about what should happen, and hide the details in a clean way.
Overall, there are a few simple language patterns that, when used together, provide a lot of power and flexibility — without the drawback of over complicated code.
- tyre 7y agoReading the update to Enum.sort, I could see in my head how easy a change this would be in elixer. Supporting a different second parameter (a symbol rather than a function) can be implemented with another function that pattern matches to :asc or :desc. They can each call the original function(s) too. In many other languages you'd start `sort` with a conditional and that function would need to handle every case. Not here. Each function worries about itself and what it can handle. There's a beauty and practicality that Elixir hits so well.
- pmarreck 7y ago> API request handling It is useful for implementing anything where there is a calling interface/surface with a bunch of verbs that can take parameters. Which is pretty much everything in programming. Which is why it's (also) useful in API dev.