-
Elixir: Do you have HTTP requests? You are doing them wrong!
The process of making HTTP requests in Elixir seems to be obvious for every developer: one should take HTTPoison (3,5M downloads from Hex.pm), and do whatever he wants! But… Have you ever thought about alternatives? If not - follow this article, and get the answer to the question:
How to make HTTP request?
-
Elixir: Brackets Hell in Supervision tree
The
Supervisor.Spec
module was deprecated and does not work with the module-based child specs, introduced in Elixir v1.5. Thus, all methods for supervision tree declaring were sugnificantly changed. It’s great time to understand the waterflow of passing arguments - from top-levelSupervisor
to low-level workers akaGenServers
. -
Functional Rust: Cooking some beef!
One day I’ve stumbled upon Brainfuck-like language “Cow”. And suddenly I’ve came up with an idea to write an interpreter for it in new hip language Rust. Rust is an multi-paradigm language, which means you have to chose in which style you want to write your code in. I’ve chosen functional programming.
-
Elixir: Your package should survive in production!
You are very good person! Great person! You have just created you first (or second, or third, etc.) package in Elixir language and published it to the Hex. You are nice enough to follow some conventions. At least this one.
The work is done, isn’t it? You’ve done everything as in official tutorial™. What problems can it lead to? “Nothing” is wrong answer…
Do you want to know why? Well… I’ll try to answer this question.
-
Elixir: Testing without starting supervision tree
Imagine simple situation: you need to test some of your code modules, but you application is made in the best qualities and traditions of OTP framework. When your tests start, your application starts also, and supervision tree starts also, and everything is running in the same environment with your tests!
Thus, you get a bench of problems:
- Your dev and test environments mix together;
- You can’t test processes, that are registered with names, because they are already started by your supervision tree;
- You can’t perform unit testing, because you are not really sure, that this testing would be really unit.
The solution is simple: Divide and conquer!