Will Myers wrote:Are lambdas enough to stop developers deserting Java for other jvm languages?
Are they in significant numbers (not in loudness by the ones gone)? Is that the (a) problem Java 8 wants to solve? (That are real, non rhetoric questions.)
posted 5 years ago
Sorry, for my sloppy answer. But I could not resist.
I do not have the numbers, how many Java developers left for other languages. And actually, I am not really interested in them.
Can only speak for myself. If I can choose, I prefere Scala over Java in meantime. I produce code, which is less error prone, then in Java. Mainly because of the usage of immutable data.
Will Myers wrote:Do you think Java can catch up with Scala in terms of functional programming? Are lambdas enough to stop developers deserting Java for other jvm languages?
Thanks for your question - I guess it depends on what you mean by "catch up". Scala has a lot of language features that Java doesn't have.
Some of those features are useful and help reduce boilerplate within common programming patterns or make it easier to "do the right thing". The obvious example to me here is case classes. A basic value type with fields, value equality, value-based hashcode etc. is a common thing to want in programming. Its something that would help probably help Java programmers and when I speak to developers about Scala it is something that seems almost universally popular. At the library level the immutable collections of Scala are a nice addition as well. On the other hand Scala adds a lot of baggage and complexity and slow compile times etc.
So I don't think the right mentality for Java's evolution is to view Scala as being the future and try to catch up. I think the right answer is to view it as a large scale experiment in language design. There's some good ideas, there are some failures. The good ideas should be rapidly adopted and the failures avoided.
Some developers are definitely moving on from Java to other languages and some new developers are always arriving into the Java ecosystem. So I'm not that personally that worried about whether a specific feature can improve Java's popularity or not. I don't think lambda expressions are enough on their own. I think the best way to maintain Java's popularity as a development environment is to continue to invest in and evolve the language, core libraries and the JVM. Lambdas/Streams/Collectors are a great addition but they shouldn't be considered the end of the line for Java's evolution - just the latest step.