I Am Bismark

Let it crash

After over three years of programming in Elixir I think I finally understand the “Let it crash” principle. I realized just how much code was being wasted gracefully handling errors that had no business being handled at all!

Basically my thinking goes like this:

If there is a meaningful error I can return to a user e.g. “bad auth token”, I should handle this gracefully and return the error. Otherwise, “let it crash”!

If the database returns something I don’t expect, crash! If S3 is down, crash! If a map doesn’t have a key that should be there, crash!

The beautiful thing about crashing: I can see exactly what happened and where in the form of a stacktrace in the logs. If I attempt to handle something unexpected gracefully, the real issue is either shifted somewhere else OR it’s swallowed completely.

This has dramatically improved my code by removing unneccesary error handling, making everything more concise and readable. I only care about the happy path!

After one year at HelloSign and many huge features later, I’m very proud that I still have a net negative 20k lines of code in the repo. I think embracing “let it crash” is one of the biggest factors in this!

Dear SFMTA, your new train design with upright bars with the exact seat spacing for 2.5 people in one section and 1.5 people in the next is masterful. A well played troll on all your riders.

Apple Watch auto-unlocking my laptop is a game changer. Going to pay for itself with time saved on mistyped passwords.

I can’t say I’ve ever wanted Github’s closed PRs to be sorted any way other that “sort:updated-desc”. Wish that was the default..

Archive