Why Scala is not so cool

A friend of mine is currently attending a Scala course on courseraand she showed me one of her issues searching for an advice. Unfortunately for her after 5 minutes i was leaving the desk as i was unable to come up with any idea.

Based on this experience i tried to have a look at Scala docummentation, so i’ve started with introduction and first thing i’ve seen was that is Java based. Considering my previous experience with a programming language writen over Java, Coldfusion(a huge resource consumer), this wasn’t the best “nice to meet you” conversation. Basically Scala is compiling your code into Java binary compatible file.

Scala programs run on the Java VM, are byte code compatible with Java

A plus was the fact that major companies were already using Scala.

For example, at Twitter, the social networking service, Robey Pointer moved their core message queue from Ruby to Scala. This change was driven by the company’s need to reliably scale their operation to meet fast growing Tweet rates, already reaching 5000 per minute during the Obama Inauguration. Robeys thinking behind the Twitter Kestrel project is explained in the developers live journal. His concise 1500 lines of Scala code can be seen as he has generously made them available as an open source project.

So far introduction hasn’t brought very much confidence in continuing, so i asked my friend to give me some key points that would represent the an advantage of using it in a real case. First and only point(due to lack of time) mentioned was a better stack management while using recursive functions. At this point i said that all recursive methods can be implemented also iterative in order to avoid stack problems while using large volumes of data. On the other hand this may raise complexity of the code.

This conversation being over i’ve came back to Scala site searching for some code examples. Look what i found:

Any method which takes a single parameter can be used as an infix operator in Scala. Here is the definition of classMyBool which defines three methods andor, and negate.

class MyBool(x: Boolean) {
  def and(that: MyBool): MyBool = if (x) that else this
  def or(that: MyBool): MyBool = if (x) this else that
  def negate: MyBool = new MyBool(!x)
}
def not(x: MyBool) = x negate; // semicolon required here
def xor(x: MyBool, y: MyBool) = (x or y) and not(x and y)

Why a programming language requires such a feature? Why don’t they like obj.method(param) ?

Leave a Reply