DEV Community

Discussion on: Why I love Java

Collapse
 
bzitzow profile image
Brian Zitzow

Java 8 did add anonymous functions. Unfortunately, bolting features like this onto Java results in a "yes we can do this, but it feels really icky because the language wasn't designed to support this. Not really." kind of experience. It's very noticeable for anyone coming to Java who has experience in a language that was designed to support lambdas.

While I haven't really used Kotlin, a quick web search comes up with examples that show it reduces the boilerplate code by 40%:

medium.com/androiddevelopers/from-...

Another disappointment (I have) with Java's implementation with anonymous functions is their incompatibility with Checked Exceptions. Again this is a result of Java adding features it wasn't designed to do.

Just 2 weeks ago I had to refactor some code a developer wrote with the Streams API and anonymous functions because we encountered a need to depend on code that relied on CheckedExceptions - and it wasn't practical or feasible to rewrite it at this time.

Java is an Okay language. My only point is that I don't find it "productive" or "developer friendly" compared to the other languages out there, especially the newer ones.

The other reasons listed in this article aren't targeted at me, because I've not used C professionally and had to deal with memory management in one of those older languages. That being said, the other newer languages on the market also handle this stuff - it's not a unique value add Java brings in the current market.