tags:

views:

364

answers:

4

Where would Erlang fall on the spectrum of conciseness between, say, Java/.net on the less concise end and Ruby/Python on the more concise end of the spectrum? I have an RSI problem so conciseness is particularly important to me for health reasons.

+2  A: 

Erlang allows you to realize functionallity in very few lines of code, compared to my experiences in Java and Python. Only Smalltalk or Scheme came near for me in the past. You've get only little overhead, but you typically tend to speaking identifiers for modules, functions, variables, and atoms. They make the code more readable. And you've got lot's of normal, curly, and square braces. So it depends on your keyboard layout how comfortable it will be. You should give it a try.

mue

Mue
+7  A: 

Conciseness as a language feature is ill defined and probably not uniform. Different languages could be more or less concise depending on the problem.

Erlang as a functional language can be very concise, beyond Ruby or Python. Specifically pattern matching often replaces if statements and recursion and list comprehensions can replace loops.

For example Java would have something like this:

String foobar(int number){
  if (number == 0) {
    return "foo";
  } else if (number == 1) {
    return "bar";
  }
  throw new Exception();
}

while Erlang code would look like:

foobar(0) -> "foo";
foobar(1) -> "bar".

With the exception being inherent because there is no clause for input other then 0 or 1. This is of cause a problem that lends itself well to Erlang style development.

In general anything you could define as a transformation will match a functional language particularly well and can be written very concise. Of cause many functional language zealots state that any problem in programming is a transformation.

DefLog
A: 

Erlang is surprisingly concise especially when you want achieve performance and reliability.

Erlang is concise even when compared to Haskell:

http://thinkerlang.com/2006/01/01/haskell-vs-erlang-reloaded.html

And is surprisingly fast (and reliable) even when compared to C++:

http://www.erlang.se/euc/06/proceedings/1600Nystrom.ppt

(18x less SLOC is not surprise).

Anyway it always depends of your preferences and goal what you want achieve.

Hynek -Pichi- Vychodil
+1  A: 

You have to spend some time, write code, to understand erlang's sweet spot, vs. all the other emerging tools, DHT, doc stores, mapreduce frameworks, hadoop, GPU, scala, ... If you try to do, say SIMD type apps outside the sweet spot, you'll probably end up fighting the paradigm and writing verbose code, whereas if you hit problems that need to scale servers and middleware seamlessly up and down, it flows naturally. (And the rise of scala in its sweet spot is inevitable, too, I think)

A good thing to look up would be the Tim Bray Wide Finder experiment (distilling big apache log files) from a couple years ago, and how he was disappointed with erlang.

I generally don't recommend putting much store in the Alioth shootout, given you inevitably end up comparing really good and bad code, but if you need to put numbers of LOC, erlang vs. C, ruby, whatever

http://shootout.alioth.debian.org/u32q/erlang.php

Gene T