Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Future investment: Erlang vs. Scala [closed]

since concurrent programming becomes constantly more important, I was wondering what you think about Erlang vs. Scala in that respect. It seems to me that Scala has a larger user base and potentially a brighter future than Erlang. Furthermore, Scala is kind of java.

I know these questions are alway a bit subjective, but what would be the better future investment: Erlang or Scala. Or even another language?

like image 245
Mark Avatar asked Jul 25 '11 17:07

Mark


2 Answers

Erlang has been designed for concurrent, fault-tolerant communication systems. You can easily write servers that handle large number of network connections and (thanks to one garbage collector per Erlang process) the servers can retain soft real-time characteristics (i.e., the whole server is not paused until GC finishes). You can also hot-swap Erlang code, distribute it across several nodes, etc. That's why (arguably) the most-scalable XMPP server (ejabberd) is written in Erlang. Yaws (a web server) is another example where Erlang excels, see: http://www.sics.se/~joe/apachevsyaws.html. Riak/Couch are examples of NoSQL DB build with Erlang. These are the problems where Erlang is a great choice.

But Erlang VM is not as fast as JVM in terms of raw computations, so as soon as you need to do something computationally intensive (e.g. financial modeling) JVM will be your preferred platform. Moreover, Erlang's concurrency model (actors) is baked in the language. If that doesn't fit the problem you're trying to solve, then you won't be happy with Erlang.

Scala is more 'general' language in a sense that concurrency, horizontal scalability, or fault-tolerance is not part of the language. It is solved at the level of libraries (that's why there are at least 3 implementations of actors in Scala). The good thing is that you can pick concurrency model that fits your domain. For example if you need software transactional memory (STM), just pick Akka and you're good to go (http://akka.io/).

Plus there is the whole argument that with Scala you can leverage your "JVM investments" and multitude of JVM libs.

You didn't give any info on what kind of software you want to write with either of those languages so it's hard to give you a definitive answer. Having said that, given all the above, Scala may be "safer" investment than Erlang (not bashing Erlang/OTP at all, it's a fine language/platform).

BTW. If a single-machine concurrency is important to you Clojure (http://clojure.org/) should not be overlooked (also JVM language).

UPDATE1: If you like what Erlang offers but not its syntax, take a look at elixir-lang.org

UPDATE2: STM has been removed from Akka - now you have a choice (mix/match) between actors (untyped or typed) and streams.

like image 127
romusz Avatar answered Oct 10 '22 17:10

romusz


It doesn't matter Just pick one and stick with it for a while. Learn some stuff, make some cool things and either keep going with that language or move on to another one.

With respect to learning concurrent programming, either will be fine. The key here is that you will be learning something new and unless there's a job opening that you are trying to get hired for that uses Erlang specifically, it really doesn't matter. Plus, even if that opening did require Erlang, you would still likely have a good chance if you knew Scala really well.

Just think, all of the time you have spent trying to pick a new language could have been better spent if you just picked one and already started learning it by now.

like image 21
Robert Greiner Avatar answered Oct 10 '22 16:10

Robert Greiner