Блог пользователя mkrlearner

Автор mkrlearner, 11 лет назад, По-английски

I am a newbie to Scala. I used to code in Java for 7 to 8 years. However coding in Scala is lot more productive. Your code gets extremely short and editor support is also good.

In terms of performance, in real time scenarios I don't see Scala so much of an issue. It comes with Functional Language paradigm where most of boiler plate code is gone. You certainly need to try it out.

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Indeed, Scala is a beautiful language, I really admire Dr. Odersky and his team (I'm from EPFL), they have designed a masterpiece, sadly it's implementation still have to mature. The decision to make Scala Java-compatible was a hard tradeoff, wide compatibility against performance. I think it was the right decision in the moment, but more power, through less verbosity and much deeper abstraction also carries a penalty (tons of layers/wrappers) on the already penalized JVM. Scala performance is questionable, even if is advertised to match Java's. Scala tried to fix some design flaws of Java, having succeeded in most cases, but there are chains (design decisions) that cannot be circumvented. Anyway Scala in a few years has grown to a production-ready level being used by big companies, diverging from many academic languages, that remains today for academic-only use. Scala complexity is something that's really exaggerated sometimes, but I've to admit; it's a beautifully complex language, but most of the time this complexity is hidden from the programmer. Currently I prefer Scala for small scripts/programs where performance isn't critical, for programming contests I stay with C++ (I'm old schooled). If Scala improves performance and effectively matches Java's then maybe I'll switch. For those who want realize how ugly and verbose is the good old imperative paradigm, please take a look at Scala, it's mind-changing. PD. Odersky's course at Coursera is a very good start.

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I would say that Scala is a viable alternative to Java, even in programming contests. But you should remember to stay away from very functional style (eg. immutable collections) in performance critical code. Use plain old loops and arrays, and the performance will be comparable to Java. As a benefit, you get a shorter code which is also more pleasant to write, with less syntactic noise/boilerplate. In addition to that, standard collection library is quite impressive.