Is it prudent to use Scala for anything new?
Is it worth using Scala for new projects that don't use Spark? There seems to be a trend to not use Scala for anything new and either use Kotlin for functional programming or use Go where parallaisation is required. PySpark is popular among Spark folks. So, is it worth building anything new in Scala?
10 comments
[ 4.1 ms ] story [ 35.6 ms ] threadIt was a 20 minute job to rewrite in Java with an executor and it got (1) a 7.5x speed up and (2) the right answer.
In other cases it was human factors like the engineering manager who told me how great it was to handle errors with monads instead of exceptions except that they never actually handled the errors. This place claimed to be doing “functional programming” but they also claimed to be doing “code reviews” but if that were really the case that eng manager would have known that policies weren’t being followed (e.g. allegedly we writing unit tests but it was few and far between.)
Personally I thin Java is going in the right direction through JDK 8, JDK 17 and now JDK 21. If anything, Java is adopting “ML the good parts.” with pattern matching, sealed classes and such.
Unless you already have a team with expertise in Scala, I don't seen the point.
Avoid it, Java is pretty OK I'd say.
Don’t use it in real world applications please, while having some nice syntax improvements over java, it is a nightmare on many other levels
You can express yourself in much less code and safer.
I do use it profesionaly for past maybe 8 years, mostly backend services.
Anyway kotlin is probably also better than java.
Also, Scala is usually a bit slower than Java (let's say factor 1.5x) which will be a problem if you need raw performance/latency, e.g. if you want to write a high frequency trading app. You will not be happy doing that with Scala.
As to why I believe Scala is more productive - just look for example at Typescript and how much it improved developer experience by supporting union-types. Scala allows to do the same. Or think of Rust and its traits that make it really easy for library interoperability - Scala has the same (in an even better form). Last but not least, Scala is currently the language with one of the best effect systems in my opinion (https://zio.dev/). Kotlin for example has copied the approach with https://arrow-kt.io/ which I think is great actually. But when comparing Scala and Kotlin here, Scala wins by a large margin, it is a completely different world. It's like building a highly concurrent system in Erlang vs C.
Of course, if you don't want to learn things like union types, traits/typeclasses and effects (similar to async/await but more powerful) you will be annoyed by Scala. But once you learned them, you can never go back.