| "Let it crash" is about code such that, if it crashes, there is a supervisor architecture that can keep the crash isolated and has sane ways of restarting. This means you don't have to code defensively: if your code crashes, it's ok. This is important because in erlang/elixir you have pattern matching, which allows you to code declaratively. Example: Imagine you have a function that expects a two-element list, `[a, b]` and then adds them. In elixir, you could write the function this way: ```
def add([a,b]) do
a+b
end
``` Note that the program will crash if you call: `add([1,2,3])` or `add([1])`. In other words, you can write code such that the shape of the code matches the shape of the data. If the data looks any other way than the expected one, it will crash. But this is a good thing! It's better than operating on data that has the wrong shape, and thhe OTP architecture should restart the process intelligently. |