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?

8 of 245 comments (clear)

  1. Twitter and Scala by ebrandsberg · · Score: 5, Informative

    https://www.quora.com/Is-Twitter-getting-rid-of-Scala

    Quote "I can't answer that, but I did attend lately a session by Raffi Krikorian, who was VP Platform Engineering at Twitter and one of the people responsible for introducing scala at Twitter.

    He was asked about scala, and said that if he would have to choose again today, he's not sure he would go with scala.

    The argument was that scala introduces a big learning curve for new developers. Because of its complicated language features it can become hard to read. So at Twitter they are trying to not overuse the complexities of the language, so the main benefit they get from it are lambdas. Which is now basically available with Java 8. So the overhead of developer training might not be worth the benefit."

    1. Re:Twitter and Scala by atrizzah · · Score: 4, Informative

      And yet, read the other answer on that same Quora page.

      I would also add that the opinion of an Engineering VP at Twitter might take into account a whole bunch of things that aren't applicable to the dev who is trying to decide whether learning a language is worthwhile to them. Those are two very different points of view, with very different considerations. I love working in Scala, but if I were building a team of probably over 100 engineers, I might think twice.

      Also keep in mind that Twitter was one of the very early adopters of Scala. They lived through growing pains in the ecosystem that newcomers to the language will never have to encounter.

      Scala has a learning curve, no doubt about it. Its design tends to emphasize features that are very general. You put in some extra effort upfront, but you get more mileage in the long run. Scala also has a very rich ecosystem of libraries that may approach the same problems with different philosophies. Some find the amount of choice paralyzing. It's a bit reminiscent of the React ecosystem. But I think I speak for many Scala fans when I say that it feels very rewarding and empowering as a programmer to work with.

      Intellectual benefits aside, I've also found it to be a language for getting things done. My small team launched a mission-critical distributed system in 6 months, with me as the only veteran Scala programmer. I give a lot of credit to the extremely robust ecosystem of libraries around Scala -- especially Lightbend's Akka and Slick. A lot of ready-made tech mapped very nicely to our problem domain, and we were off to the races. The documentation is great and there's lots of support available.

      My advice for the OP: take the Coursera course and/or give the Red Book a spin. You'll likely be challenged but also you may find it to be very intellectually stimulating.

  2. Yes. by Just+Some+Guy · · Score: 2, Informative

    I don't have a strong opinion about Scala, but the answer to questions in the form of "should I Move from Java to _____?" is almost always "yes" (for values of _____ not including PHP, VB*, or other asininities).

    --
    Dewey, what part of this looks like authorities should be involved?
  3. Re:Java is garbage by phantomfive · · Score: 2, Informative

    It exists because in Java, it's easy to work with a team of less-competent enterprise programmers on a multi-year project where new people are coming and going, without your codebase turning into an unworkable pile of garbage. That is the main advantage of Java. It is the COBOL of the modern age, and C# is its twin brother.

    Of course, you can work with a project like that in C (for example), and I've seen it done, but you need to have strong leadership architecting the code and making sure things stay clean. Whereas in Java, you can get by with a mediocre architect and weak oversight and still come out alright (but the C project in that situation will be an unworkable mess. That goes for Python too, and Ruby apparently, if we can judge from Twitter's failure).

    --
    "First they came for the slanderers and i said nothing."
  4. Probably yes by hibiki_r · · Score: 5, Informative

    First, background: I have been using Java at work, at least part time, since 2005. I started getting paid to write scala since 2012. I've definitely ran large, critical applications in Scala: I am running some right now.

    Scala is a far more featureful, complicated language than Java is. A lot of what it gives you is really very high quality syntactic sugar (case classes, lambdas, pattern matching), but the one thing that sets it apart is its type system.

    The trick is that nothing forces you to use Scala as if you were using Haskell instead: You can use it as a more sugary Java, using the extra type system fun sparingly. Restraint is the name of the game here, and also the reason some people have Scala horror stories: A company decides that Scala sounds great, and then hire some hotshot scalaz committer to teach everyone else how it's done. Then your codebase is full of operators that look like line noise, every class extends a base that comes straight from category theory, and half the developers say 'screw this, let's rewrite it all in Go!'

    There is value in the category theory, and using arcane libraries like cats or shapeless, but 99% of the time, you don't need to: Just like back in the 90s you had to stop people from overusing OO design patterns, or their code will end up looking like Spring, Scala shops have to remind people to do the same when it comes to higher kinded types, hlists and concepts out of category theory. You really don't need any of that to use Scala successfully. Just ending up in a world where you typically don't need either a mocking library or any dependency injection nonsense is more than enough to switch. (Curse you Rod Johnson!)

    The one thing where I would make people spend some time studying is in basics of functional programming, the very first of which is to learn to remove side effects from code, and clearly separate code that changes state from computation. Chances are you were doing some of that already in Java if you were hoping for a good unit test suite, but it's more important in Scala

    Career wise, the more is a no brainer IMO: If you write Java, you are one in a very large pool of completely generic candidates that can use Spring and Hibernate to do something super boring. In Sala, you enter a smaller pool that most of the most average Java developers will never try to enter, so, on average, the job will be more interesting, and the pay will be higher.

  5. Re:Location, Location, Location by Stephan+Schulz · · Score: 4, Informative

    I don't know where Scala is, but Java sounds like a nice place to live.

    It's in Milan, Italy. See La Scala. Also a nive place to live.

    --

    Stephan

  6. Only If You Plan For Your Code 2 B Incompatible by Foofoobar · · Score: 3, Informative

    With all the Scala hype, people neglect to point out that Scala is NOT compatible with Java; alot of libraries and tools have to be rewritten to work with Scala. This is why LinkedIn dumped Scala, Spring dumped its Scala adaptation and more and more companies are dumping Scala. And for all its hype on 'functional programming', you can do the EXACT same thing in Java and Groovy with 100% compatibility. In fact, every Java class converts 100% to Groovy; take any Java class and change the '.java' extension to '.groovy' and it will compile without issue. The same CANNOT BE SAID OF SCALA! This is because it is not compatible with Java and requires Java rewrites in order to be compatible.

    --
    This is my sig. There are many like it but this one is mine.
  7. Re: Maybe Kotlin by cmorriss · · Score: 3, Informative

    It's quite stable at this point. JetBrains has released version 1.1 and anything written in 1.0 will work long term. We're using it in production and have had zero issues. I honestly don't see how someone could pick Scala over Kotlin if they've actually looked at Kotlin seriously. This biggest win is that it's syntax is close enough to Java that a new team member can read it and understand the code without even having worked in it at all.

    --
    10 minutes working on a sig. What a waste.