开发者

Future investment: Erlang vs. Scala [closed]

开发者 https://www.devze.com 2023-03-22 23:32 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answe开发者_C百科rs to be supported by facts, references,or expertise, but this question will likely solic
As it currently stands, this question is not a good fit for our Q&A format. We expect answe开发者_C百科rs to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

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?


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.


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.


Both languages, at the core, are not that hard to learn, and also to learn the concurrency features they provide. In fact, Scala actors are influenced by Erlang actors. I would go to both of them, take your time looking at their construct, do some tests in concurrency problems, etc.

If you know Java, Scala will be more natural, as Erlang is more like prolog. If, on the contrary, you're more oriented towards mathematical or logical type of languages, start with Erlang.

0

精彩评论

暂无评论...
验证码 换一张
取 消