4 ms·
Besides Spark, is there still a niche that Scala fills? Why wouldn’t you just use Kotlin or Java 11? I guess I should ask the inverse question too: why wouldn’t
by jxi 7y ago
Besides Spark, is there still a niche that Scala fills? Why wouldn’t you just use Kotlin or Java 11? I guess I should ask the inverse question too: why wouldn’t you just use Scala for everything?
- dmit 7y agoBackend web services. Scala has top notch tools to model domain objects, handle a high volume of incoming requests, process transactions (including async ones). tl;dr: like the JVM and dislike root causing NPEs? Scala might be for you.
- mruts 7y agoScala is significantly more powerful than both Kotlin or Java 11. Why would you want to use either instead of Scala?
- solidsnack9000 7y agoInteroperability and default non-nullability are both advantages of Kotlin.
- pjmlp 7y agoInteroperability leaves a bit to be desired though. Try to use Kotlin sequences, co-routines, lambdas (not SAM types) or operators from Java code.
- mckinney 7y agoQuite a lot of shops choose not to use Scala because of the power. For instance, I can easily write Haskell-like code with Scala and build DSLs galore, which for me is great. But what happens when you need to hire more developers? That's the rub.
- mruts 7y agoYou probably are better off not hiring those developers, then.
- apta 7y agoSlow compilation and build tools (scalac and sbt), buggy/overlycomplex standard lib, interoperability, better IDE support in alternatives, academia oriented.
- pjmlp 7y agoBecause Java is the systems language of the platform. I don't want to bother with extra layers or be bound to JetBrains tooling.
- mruts 7y agoScala isn’t another layer, it compiles to JVM bytecode. Also, what does Scala have to do with JetBrains?
- pjmlp 7y agoTry to use Scala from Java to see how those bytecodes look like. It is another layer exactly because you need to translate back those bytecodes into Scala semantics when debugging, when everyone wraps Java libraries into Scala idiomatic wrappers. I was referring to Kotlin regarding JetBrains.
- threeseed 7y agoScala is one of the few languages where you can write an entire web app in the same language (ScalaJS + Scala). This is incredibly useful when you pair it with RPC and a shared domain model.
- KajMagnus 7y agoI'd use Scala or Rust for everything. In Java, one creates a 55 lines getter-setter class with concurrency bugs and accidental mutation risks, and maybe plus a 55 lines Builder too. Whilst in Scala I create a 5 lines case class, immutable and thread safe, all that's needed.
- apta 7y agoJava is getting data classes (case classes in Scala), as well as value types.
- mckinney 7y agoData classes are nice, but they are not a general substitution for Properties, which address the greater getter/setter boilerplate concern. That said, you can use project Lombok for that pretty straightforwardly. You can also use project Manifold[1] to add useful features many of which Scala lacks: * Type-safe metaprogramming (like F# type providers) * Structural Typing * Extension methods * String interpolation * Templates * Type-safe reflection * [Un]Checked exceptions [1]: https://github.com/manifold-systems/manifold https://github.com/manifold-systems/manifold
- KajMagnus 7y agoInteresting, I didn't know, thanks for mentioning.