Search code examples
javascalajvm-languages

Is anyone using Scala in anger (and what advice for a Java programmer)?


I've been a Java programmer for over 10 years since starting off with Smalltalk. It's my opinion that next big languages are likely to be ones which run on the ubiquitous Java Virtual Machine. I'd like to take advantages of some of the features that Scala (among other languages) has - case statements for class hierarchies, closures, type inference as it will allow me to write more concise and clear (I hope) code. A bit closer to Smalltalk!

All the things that are second-nature in Java:

  • Building with ant
  • deploying applications/libraries into logical jars
  • Great IDE tool support
  • Writing GUIs (or having a Swing GUI talk to it via some kind of remoting?)
  • 3rd party libraries/frameworks
  • Configuration (properties, XML, Spring etc)
  • DB drivers etc

I'm concerned that the difference between playing around with some pet project and actually making the leap to using it in anger in the workplace is a bit too much.

  1. Has anyone made this leap?
  2. Was it worth it?
  3. What lessons did you learn?

(Obviously people are using Scala - but is anyone building actual, for the want of a better word, Enterprise applications?)


Solution

  • I have used Scala on our existing Java infrastructure to query and manipulate large xml documents. Was not possible using the standard Java xml libraries or not as easily.

    I was tempted to use it for portfolio performance calculations, but had already finished the Java version. A Scala version would have been easier to maintain as it is easier to translate the formulas directly into code.

    Another area where you can sneak in Scala is with multithreading. Have no real experience with this, but it seems to be easier in Scala.

    Point is, don't try to see it as a Java replacement for now, but use it where you can utilize it strenghts next to your existing Java code.

    I used Intellij with the Scala plugin as an IDE, but it is not there yet. It is do-able in combination with the maven plugin and the console.

    I'm also a Smalltalk programmer and love being able to use code blocks in Scala. Compared to Java there is less code, but still not as readible as Smalltalk code.

    BTW, the smalltalk community is growing again thanks to the Seaside framework, so you might want to return

    The things I learned or got a better understanding of:

    • the use of constructors
    • the immutable concept
    • working with lists and recursion
    • functional programming in general

    So yes, I think it is worth it.