Scala versus Java 8

Lots of Java developers love Scala and prefer it over Java either for new projects, components of existing Java projects or even performance-critical parts of existing Java modules.

Thanks to that Scala has made its way to an enterprise world and is gaining popularity day by day.

Big boys like Amazon and Blizzard have already made a good use of its benefits.

And between Redwerk and Scala it was love from the first sight.

There have been lots of articles that made clear the fact that although somewhat complex upfront, functional approach of Scala multiplied by its full Java interoperability makes it far superior to plain old Java 6 or Java 7.

But Scala has proved itself useful to the point when new releases of Java started to incorporate features of Scala, and other functional languages as well. With Java 8, Oracle has caught up with the trend of pumping up conventional imperative OOP languages with functional programming features. 8th release Java has incorporated most popular (among developers) functional features of Scala, the ones that lessen the routine of trivial operations in developers' work:

  • Support for lambda expressions, which means no more tons of unnecessary code for common operations (like working with collections) in 21st century;
  • Support for higher-order functions, so you can make your code more reusable, much less literal and more self-explanatory;
  • Parallel collections, so now you can enjoy some benefits of multi-core systems for data
  • processing without a headache;
  • Type inference (still only on runtime level, though), to make code less literal and more reusable;
  • Virtual extension methods (as opposed to traits in Scala) to allow new behaviors for your classes;

Taking a closer look, many approaches introduced in Java 8 are similar to the ones in Scala. So is there still a difference, and should one really choose Scala over Java?

Should you really bother?

That's what this article is all about, we present you our comparison of Scala and Java 8 as a list of distinctive features.

Continue reading Part 1 on CodeProject >>
Continue reading Part 2 on CodeProject >>

10 Differences Between Scala and Java 8 5.00/5 (100.00%) 4 votes