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?
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?
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."
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?
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."
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.
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
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.
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.