Good and Bad Elixir

# · 🔥 345 · 💬 148 · 4 days ago · keathley.io · todsacerdoti
Foo.]. Side-effecting functions tend to return "Results" like |. If your dealing with side-effecting functions, don't pipe the results into the next function. Using pipes forces our functions to handle the previous function's results, spreading error handling throughout our various function calls. Each of these functions has to know too much information about how it is being called. In the pipeline example, the functions know how they're used, how they're called, and what order they're composed. If your in a situation where errors are a vital part of your functions control flow, then it's best to keep all of the error handling in the calling function using case statements. As a general rule, you should strive to eliminate functions that only have a single call site. For the same reason, under no circumstances should you annotate your function calls with a name just so you can differentiate between them.
Good and Bad Elixir



Archive | Send Feedback | WebAssembly Version (beta)