Monday, January 30, 2017

When to use Elixir over Clojure?

Elixir and Clojure are very similar languages, almost akin to C# and Java, and you won't have much difficulty going from one to the other.

  • The syntax will change.
  • The libraries will not be the same.
  • The target VM will be different.

Appart from that, most things will be pretty similar.

So when should you choose to use Elixir over Clojure?

Whenever you want to use BEAM, or to put it in more details:

  • When you need highly distributed parallel processes with fault tolerance and high availability.
  • When you want soft real-time guarantees.

When should you choose Clojure over Elixir?

  • When you need to use the JVM for compatibility or library reasons.
  • When you need a single process and single machine performance matters.
  • When you want a coherent server and front-end language ecosystem: Clojure/ClojureScript
  • When you want a functional language instead of Java.
  • When you want a strong dynamic language instead of Java.
  • When you want a very interactive REPL workflow.
  • When you want to make heavy use of macros, and maybe create a lot of custom DSLs.

There's one case where the choice will be harder and that's when you need distributed processes, but don't need that many of them. In this case, I think you should pick the one who's syntax and libraries you prefer, since both can adequately deliver on that use case.

No comments:

Post a Comment