Slashdot Mirror


Ask Slashdot: Should I Move From Java To Scala?

"Scala is one of the JVM languages that manages to maintain a hip and professional vibe at the same time," writes long-time Slashdot reader Qbertino -- building up to a big question: One reason for this probably being that Scala was built by people who knew what they were doing. It has been around for a few years now in a mature form and I got curious about it a few years back. My question to the Slashdot community: Is getting into Scala worthwhile from a practical/industry standpoint or is it better to just stick with Java? Have you done larger, continuous multi-year, multi-man and mission-critical applications in Scala and what are your experiences?
The original submission asks two related questions. First, "Do you have to be a CS/math genius to make sense of Scala and use it correctly?" But more importantly, "Is Scala there to stay wherever it is deployed and used in real-world scenarios, or are there pitfalls and cracks showing up that would deter you from using Scala once again?" So share your experiences and answers in the comments. Would you recommend moving from Java to Scala?

4 of 245 comments (clear)

  1. Just look at it and program in it a bit by cheesybagel · · Score: 3, Insightful

    Then figure out for yourself if you like it or not. If you're going at this from a PHB perspective just stick with Java.

  2. Rust by 110010001000 · · Score: 3, Insightful

    You should switch to Rust. No wait, Swift, er no, Ruby, er no. Don't worry about the flavor of the year language.

  3. Difficult, enjoyable, productivity, consequences by Anonymous Coward · · Score: 4, Insightful

    I have a PhD in CS and have coded in many many languages.

    Difficult: Yes, I find that is the most difficult language I've ever coded in, but I really enjoy it. The difficulty mainly has to do with the type system, the compiler, and what I call Shiny thing syndrome (STS). When first learning I found occasional surprised in assignments because I had the same types on the left and right hand side, but did not. When examining the types, one would observe a page describing it. This can cause frustration for the novice. The compiler messages and the documentation have both improved immensely in recent years, so this is not as bad a problem as it once was, but still, the documentation is not a gentle guide for the initiate to understand the language. Finally, STS. There are some aspects of the language that seemed to have been simply shoe-horned in, often syntactically. That is, there are many multiple ways to do the exact same thing and all where shoved in because they exist that way and were a shiny thing in some other language. This hurts the language in my opinion.

    Enjoyment. I find that when I am coding in Java or other languages I miss features of scala. I have grown to prefer scala over java, which I didn't initially think that I would. I find that I can write a lot of code for 30 minutes in Java or I can sit on my hands looking at the screen for 25 minutes and write for 5 minutes a beautiful piece of code that does the same thing with Scala. The code has an elegance and beauty to it. Actually I don't think I stair at the screen all that long anymore but switching to functional was initially quite the paradigm shift for this old fart.

    Consequences ( Scala is not without its issues):
    1) The difficulty of the language makes it very difficult to be productive with novice coders on your team. Don't do it.
    2) Some aspects of the language: e.g. Macros, implicit parameters, implicit types, can make for elegant code, but can also make your code look like magic that will baffle your (less than stellar) team member. Use with caution.
    3) You will think different after mastering it, that is a good thing. Nothing special about scala, you should learn new languages frequently for this reason.Scala will help you.
    4) Don't do it because it is a hot new language, don't do it because you think it will solve a problem better than another or you'll make more money, do it because you love to code and you want to explore using a new tool set. Do it for the fun. I enjoy coding in Scala much more than java, and the akka actor framework is great. But you will find many analogues to the actor framework (example go routines, rust channels etc)*, but it all addresses the difficulties of multi-threading, which are somewhat cumbersome and error prone in Java.

    *Yes I know they are different, before you pretentiously lecture me on the difference, please realize that I am comparing not contrasting here. They all have the same goal to approach simplifying life in the multi-threaded environment.

    Anyhow, my advise is pursue learning scala with vigor and wild abandon. I'd also recommend go-lang and rust, they are cool also. After you learn them then decide on the tools that you want to work professionally in. You will not be harmed by the effort.

  4. Re: Twitter and Scala by 1+a+bee · · Score: 3, Insightful

    Agree. Coded in Scala. A large language -- makes C++ look tame, by comparison. Which in turn makes many 3rd party libs harder to read. Java 8 (look at Streams) offers many similar features in a smaller language that's easier to communicate. Learn Scala? Of course. But don't dive into its depths. We must all budget our time.