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 know where Scala is, but Java sounds like a nice place to live.
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.
Scala has achieved critical mass, it has shown steady growth over the years and will likely continue. It is entirely possible it will never become as big as Java but that should not be the requirement, it is plenty big enough you can count on it.
I have been developing large scale projects in Scala for the last 6 years and I can't imagine going back to Java now. Scala makes it easy and fun to write good correct code.
Scala is boilerplate free, it feels a bit like your favorite scripting languages yet with compile safety a powerful type system and lot's of help from IDE.
Obviously Scala supports Functional Programming which is essential as everything becomes multi threaded and/or distributed. Scala makes it easy to write functional code and is immutable by default, yet it isn't opinionated and you can use other paradigms when they make things easier/faster.
It's fun to write, you don't have to be a genius to use it, though with weak members on your team you will want a strict style guide. I found using Scala is a selling point when recruiting top talent, even those who never used it. Those who have used it, especially coming from a Java background are instantly hooked.
This was verified again in recent Stack Overflow developer surveys where Scala came out to be a very loved language, nearly everyone who tries it falls in love.
I highly recommend
If you want to schlep all the way from Indonesia to Italy, sure, why not.
systemd is Roko's Basilisk.
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.