
Love It or Hate It, Java Continues to Evolve - nfrankel
https://www.azul.com/love-it-or-hate-it-java-continues-to-evolve/
======
boyter
In my experience most people don't like Java due to experiences they had
before Java 8. This means they were used to the bloat, config as XML style
world which made Java a pain to write and slow to run.

Once I show them Java 11 with var keyword, lambda's and streams they start
appreciating how modern the language has become. Then you throw in frameworks
like javalin or sparkjava and suddenly they are not as hostile as they were
before.

Honestly the only things I would really like out of Java these days are data
classes and possibly native runtime compilation out of the box. Containers
solve the latter issue, but id love to just build a binary and run it.

Do that and its on the same level as Go in many ways which nailed the tooling
and deployment model, even if the language has issues. Java already has the
tooling.

I suppose a decent syntax highlighter library like pygments or chroma would be
nice too.

~~~
unscaled
Java 11 is obviously much better than Java 8, which is still leaps and bounds
ahed of Java 6, itself an improvement over Java 4. You'd see the same in every
language.

Java's problem is that for many years it used to be the slowest car around.
Maybe this was one of the things that helped Java become the undisputed ruler
Enterprise Inc. but now it's got a lot to catch up with, and even though the
pace has picked up since Java 9, it's far behind its competitors.

Everything you mention (var, lambdas, streams) and everything you might
mention when Java 13 comes out (switch expressions, text blocks) is just too
little, too late.

Yeah, var is a lifesaver if you have to use Java, but compare the limited type
inference it brings to the table with almost any other competing language
(Kotlin, C#, Scala or Swift) which at the very least can do a return value
inference.

Likewise, streams are long due, but the syntax is horrible and the repertoire
of built-in operations is meager, and since Java does not support extension
functions like the rest of the languages mentioned here you can't extend them
gracefully.

If you take one of the examples given here:

    
    
      var grades = school.students()
                     .stream()
                     .flatMap(student -> student.grades()
                        .stream()
                        .map(grade -> new NamedGrade(student.name(), student.grades())
                     .filter(x -> x.grade() > 60)
                     .collect(Collectors.toList());
    

Kotlin goes the same route, but makes it little more natural to use:

    
    
      val grades = school.students
                     .flatMap { (name, grades) -> grades.map {
                                  NamedGrade(name, it) 
                      }}
                     .filter { it.grade() > 60 }
                     .toList()
    

Besides simply more natural syntax, get the special 'it' variable,
destructuring, more operations and

Now take C#, a language had something "Streams" since version 3.0 (released 7
years before Java 8):

    
    
      var result = students
                      .SelectMany(student => student.Grades.Select(grade => new { Name = student.Name, Grade = grade }))
                      .Where(record => record.Grade > 60);
    

Where you get anonymous records - you don't need to define a new type anymore.

Or with LINQ:

    
    
      var result = from student in students select
          from grade in student.Grades 
          where grade > 60
          select new { Name = student.Name, Grade = grade };
    

You get a highly readable built-in query language as well.

~~~
rjbwork
Quick nitpick. Both of the C# examples are called LINQ. The first is called
the "method syntax", the latter is called the "query syntax". The query syntax
is transpiled into the method syntax before compilation.

------
taneq
I think the reason so many people have mixed feelings about Java is that
"Java" is actually several things:

\- The Java language

\- The Java API (and/or whatever set of libraries you're using)

\- The Java ecosystem, tooling, etc.

\- The sorts of work typically done these days with Java

It's perfectly possible for one person to feel strongly one way about some of
those aspects while feeling strongly the other way about others.

For instance, I'm quite fond of the Java language, I mildly dislike the Java
API (in how bloated it's become), I'm ambivalent about the ecosystem, and I do
my best to avoid the "Enterprise Software" CRUD-churn that Java development
often entails (although this might have changed, it's been a while since I did
Java commercially.)

~~~
schpaencoder
Not a die hard java/go-or-anything entusiast, but replace the name Java with
Go and you have the exact same thing.

~~~
vijaybritto
But with Go you can iterate quickly compared to java as the compilation time
is very small. This difference is massive in big projects. This is an
important reason why I took up Go for many projects.

~~~
sgift
Can you give a few numbers what counts as "very small" here? Most of my big
java projects take less than two minutes for a full compile and incremental
compile of the whole project is usually in the range of 10 secs. If you run
the whole test suite it can take longer depending on the tests, but that's not
what I'd count as "compile time".

------
gplusplus
My biggest issue with Java isn’t even the language, it’s the culture. I feel
like typical Java solutions are just layers upon layers upon layers upon
layers of abstractions, frameworks inside of frameworks, and stack traces
taller than skyscrapers. It’s just too much!

It seems like the Java community has lost the art of coding without a
framework. It feels incredibly bloated and entirely too magical. But this has
more to do with the ecosystem and philosophies of the community, rather than
the language, or even runtime, itself. From a purely language and runtime
perspective, I think it’s fine.

But I don’t enjoy it. Every time I need to work on a Java project, it’s like
it’s a form of punishment. I’d rather do basically anything else.

~~~
Nursie
To me you're talking about the java of a few years ago. It's really not the
case now.

The enterprise-y types are no longer dominant in the space.

~~~
xboxnolifes
But the Java of a few years ago will still need to be maintained for many
years to come.

~~~
Nursie
Maybe so, but that's not a job I'm interested in :)

------
vmurthy
Stack Overflow yearly survey[1] mentions that ~40+% developers who took the
survey use Java. Not very surprising if you look at how long ago Java came
into being (24 years ago!). I, for one am happy that it continues to evolve.
At the very least it shows that the developers of the language are still
taking lessons from the programming languages ecosystem :-)

[1][https://insights.stackoverflow.com/survey/2019#most-
popular-...](https://insights.stackoverflow.com/survey/2019#most-popular-
technologies)

------
sbov
Java 8 made it an "okay" language for me to use.

It's a lot better nowadays, but historically the biggest problem with Java has
been the 3rd party libraries. They tended to be written with extensibility in
mind at the expense of usability. Extensibility is great, but it's not the
only important thing in a design.

I'm not a huge fan of annotations. It makes the language feel a bit magical
and hard to debug in some places. It can be difficult to track down how a
given library actually treats an annotation - or even a set of annotations
since you can put more than one on a given thing. It puts the language in a
strange place: sometimes both boilerplate-heavy and magical.

> The introduction of annotations in JDK 5 has made enterprise Java
> development a whole lot simpler by allowing things like dependency
> injection.

This is a bit weird - you don't need annotations to do dependency injection.
And you don't need a DI framework either. One thing I don't quite understand
is the infatuation with DI frameworks in Javaland. I prefer to just do it by
hand where both necessary and plausible.

~~~
rurounijones
99% of the time I see DI used in Java it is solely to enable mocked
dependencies in unit testing rather than injecting different production
implementations depending on environmental differences or something like that.

I have had Code Reviews where "This is all good, but you should use Guice to
mock X" where X is the one time I might have a package-private test only
constructor with a NullObject for the one dependency I need to mock out in a
commit and Guice is not currently used in the package at all.

Personally I think DI has reached cargo cult status in Javaland.

~~~
miohtama
Dynamic languages like Python do not have this issue as you can mock any
method runtime for the duration of test. This can done via "monkey patching".
It is unclean, but the development cost of having a framework to do just this
is a tad high.

The only downside is that if you parallel test you need to run them in
separate processes (which you usually want to do.any case).

------
intothemild
My only problem with Java is how it’s written. Enterprise java tends to be
abstracted to absurd levels. I prefer a more direct approach.

~~~
signal11
Yes @ absurd level of abstraction, EnterpriseFizzBuzz even manages to laugh at
this old-school 'Enterprise' style of writing code[1].

Some enterprises have managed to move away from this though -- DevOps in the
enterprise is real and it looks pretty similar to DevOps elsewhere.

I've worked with teams in very conservative enterprises that have automated
tests and CD pipelines, and release 100s of times a day, and support their own
code. And with their newfound autonomy -- no more diktats about "use J2EE"
from up top -- these developers did what smart developers do: simplify and
reduce dependencies and tech debt. Lots of vanilla JS (or maybe React at
most), plain old Java, even Kotlin and Clojure where possible (microservices
made polyglot development really easy).

I've always thought this was a big reason Oracle dropped J2EE. Their most
conservative customers weren't interested as J2EE had become irrelevant for
their needs.

Here's a public video of how one institution (JP Morgan) managed to
modernize[2].

[1]
[https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...](https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition)

[2]
[https://www.youtube.com/watch?v=Tyev4Ti9Xsc](https://www.youtube.com/watch?v=Tyev4Ti9Xsc)

~~~
jmkni
I love the fact that EnterpriseFizzBuzz has 271 open issues!

------
0xferruccio
The only reason I like Java is that it allows you to sneak in Clojure code.

“I’m going to build a solution that runs on the JVM”

~~~
oulu2006
I made Clojure a first class citizen at my startup :)

------
ragerino
Most people don't even know why they hate Java. And the rest hates it because
their Chief Architect taught J2EE is a great idea.

~~~
yoz-y
Personally I developed a dislike for it because of Eclipse, Android Studio,
Swing and JavaDoc.

~~~
jtdev
Those are at the top of my list as well... in addition to Hibernate. Maven
appears near the top of my list too, I mean can we please chill out with the
copious XML already? Not to mention naming a real construct a "bean" rather
than something that actually describes what it is, annotations and other
magical shit (AOP anyone?) scattered throughout many Java codebases.

------
packetpirate
When I first went to college for my Associate's Degree, we learned C++ and had
the option to choose between Java and Visual Basic. I chose Java, obviously,
because who the hell wants to know Visual Basic?

I really liked Java back then because C++ had always been a struggle, not
because of pointers or anything like that... but because I always found
project management, figuring out how to link libraries, and build my projects,
to be overly complicated. With Java, I only had to import a library, and that
was it. I didn't need to link external libraries because Java's standard
library was large enough that it had most of what I needed at the time, and
adding external libraries wasn't nearly as difficult as C++.

However, over the years, I feel like I've kind of grown apart from it and have
started to want to migrate back towards C++ and Python. I still use Java
because it's the language I know best and it's the language I'm writing my
game in, but after I finish my game, I think I'll be using it significantly
less. The bulkiness of the code, the complications from the JVM, and the lack
of good options for deploying executable code is just getting more and more
frustrating.

Also, as I was working on my Bachelor's Degree, filling in the gaps of
knowledge left by a "meh" education at my previous school, I could see that
Java is just not good for writing good, fast code.

That said, Java 8 did make me like Java a lot more when it came out, but
they're starting to deploy new versions so frequently now I feel like 8 is the
last version I will bother learning.

~~~
apta
> and the lack of good options for deploying executable code

GraalVM is a way to resolve that: [https://quarkus.io/](https://quarkus.io/),
[https://micronaut.io/](https://micronaut.io/)

You might want to check out C# as well. .NET Core is coming along nicely, and
you get to work in a safe environment, with the ability to drop down to
pointers if needed, unlike the unsafety that is inherent to C++.

There is also a C# to C++ compiler that the Unity people wrote, worth checking
out.

------
imtringued
I'd like to see a JVM with a garbage collector that isn't designed to always
consume the maximum amount of memory before it starts collecting. If you
configure the JVM to have at most 400MB and it's current heap size is 120MB
and you allocate 0.5MB every second or simply allocate 400MB of temporary
objects that could be collected right away, it will allocate more GC heap
until it hits the maximum 400MB and only then it decides to start a collection
cycle. This makes the JVM useless for anything that isn't a web server that
uses the entire RAM anyway.

Although Shenandoah looks promising but it's pretty telling that even in 2019
the JVM only has a single good garbage collector and it's still experimental.
23 years of history my ass. Other than the awful JEE ecosystem, the JVM is
probably the worst part about the Java ecosystem. You can't fix it with a
language that runs on top of it. It's slow (mostly startup performance), the
GC is awful and it gobbles up a huge amount of memory. Obviously my company
doesn't care because 8GB of RAM for a webserver costs them almost nothing.

It wouldn't surprise me if a WebASM implementation will take over one day,
because the JVM is such a failure.

~~~
apta
The JVM has state of the art GCs, name another platform that comes close in
terms of offering the ability to tune it for throughput or latency as the JVM
does, or that comes close in performance (.NET probably is the only
contender).

If you don't want memory usage to go up to 400MB, then you can set the maximum
memory the JVM can use to less than 400MB. It only makes sense from an
efficiency and throughput standpoint to use as much memory available for
performance.

JVMs regularly run on GBs or even TBs of heap space in production.

Both Shenandoah and ZGC target lower pause times (at the expense of
throughput, naturally). There are commercial offerings like offerings from
Azul that target low pause times as well.

> the JVM is probably the worst part about the Java ecosystem

On the contrary, the amount of optimizations that the JVM performs, as well as
the monitoring, management, hotswapping, etc capabilities are second to none.

> It's slow

The fact that the JVM tops several charts here says otherwise:
[https://www.techempower.com/benchmarks/#section=data-r17&hw=...](https://www.techempower.com/benchmarks/#section=data-r17&hw=ph&test=json)

> (mostly startup performance)

This is already being resolved through GraalVM. See for example
[https://quarkus.io/](https://quarkus.io/)

> because the JVM is such a failure.

It only runs the backends of companies like Amazon, Google, FB, EA, LinkedIn,
Ebay, Apple, Netflix, and countless others. Not to mention it's being used in
high performance spaces like HFT.

------
Forellen
Only a person who loves something would start with "Love it or Hate it", FYI.

------
pts_
"James Gosling, the Father of Java, described it as a Blue collar programming
language."

I wonder what can be considered a white collar programming language which is
actually used a lot. Erlang? ES6 with ever changing front end frameworks?

~~~
Barrin92
Python or Ruby I'd say, Erlang's a little bit too unique I think for that
analogy

~~~
pts_
Python/Ruby are even easier than Java and don't require much skill to master.

------
oftenwrong
I both love and hate it. I love the high quality libraries and ecosystem,
reasonable performance, simple semantics. I hate the annotations and
reflection magic, bloated frameworks, type erasure, lack of null safety, build
systems. Luckily, it is possible to avoid some of that by not jumping on the
bandwagon's standard stack. Leave that framework on the shelf, and Just Write
Java. Unfortunately, many existing Java projects you come across in the wild
are trainwrecks.

------
javathrow3030
Which lib/framework to use today for a webapp backend development in Java ?

(I am senior dev, some past java7/8 core server experience, FE will probably
be React and then mobile)

~~~
rudolph_codes
Vert.x + RxJava is great :)

------
KorematsuFred
What kept me away from Java was mostly configuration rather than language
itself. You had to manually place jars in some lib folder, have things like
"classpaths" and lot of this shit was glued together using XML files.

But once gradle came into picture along with IntelliJ I totally moved to Java.

------
vitro
One thing I would really love to see is a better way how you manipulate
strings. Variable interpolation would be nice and you wouldn't have to have
all that ugly string concatenation all over the place.

~~~
cutler
Don't forget regular expressions. How anyone puts up with having to escape all
backlashes is beyond me. But, then, I'm used to Perl and Ruby. Scala, Clojure
and Kotlin don't have this problem so why is the Emperor Without Clothes That
Is Java having such a hard time?

~~~
floriol
Because it's 20+ years old and tries to be as source compatible as possible?

~~~
cutler
Perl and Ruby are at least as old but I never had to backslash everything when
writing regexen in Perl or Ruby.

------
_pmf_
There has been about a 7 year window of opportunity for Oracle to really push
JavaFX as cross platform UI, but they insisted on making it hard to legally
use even for desperate Java Swing developer. Almost every Java Swing shop I
know is either still on Swing, switched to .NET or switched to web shit.

Why, why, why did they not make JavaFX on Android a first class citizen?

~~~
pjmlp
You have to ask Google why, not Oracle.

Oracle has made JavaFX open source and available to everyone that wishes to
work on it.

[https://openjfx.io/](https://openjfx.io/)

[https://openjdk.java.net/projects/openjfx/](https://openjdk.java.net/projects/openjfx/)

[https://gluonhq.com/products/mobile/javafxports/](https://gluonhq.com/products/mobile/javafxports/)

Naturally Google prefers to push Android J++.

------
ryuukk_
problem is it evolves way to slow that alternatives already emerged and are
used by a lot of people who were looking for alternatives

so yeah, evolving in an empty ocean

------
suyash
I love Java, it's awesome language!

------
dmix
Why are the links larger than the body text on mobile? It’s so annoying trying
to read this whole article. Especially when one of the links is pushing their
commercial support of Java.

Good design and java rarely go hand in hand. These small details matter. I
don’t think it’s a mistake that Ruby, JS, Rust, Elixir, etc attract people
with good design sensibilities which is reflected in their blog posts,
websites, and also API designs, documentation, etc.

But otherwise this articles content is not bad, I think we all know why Java
and C++ are so popular. It’s one of the first questions every programmer
learns their first year programming. This article is a good summary of why.
The fact both C++ and Java got things like Lambdas and other modern stuff in
recent years is great, but they are obviously incredibly late to the game.
Which makes you wonder how long until the other good things will take. Maybe
that whole backwards compatibility with decades of some questionable code
being a dead weight dragging down the language is one of the reasons why
people hate it? You can repaint a broken down house but that doesn’t mean it’s
as good as the new house next door.

~~~
simion314
Any language that will survive as much as Java or C++ will accumulate some
baggage, even your cool shine new language will look outdated 20 years from
now to the new cool programmers.

Look at other examples, CSS - full of bad examples on how do do X, JS - a lot
of bad parts, missing core stuff like importing modules , Python - it had is
issue caused by some old decisions that caused a lot of pain when migrating
version 3.

My point a 5 old years new language will eventually have similar issue in
10-15 years

~~~
kkarakk
The point is to work at the sweetspot of emerging language/high pay and then
get out once the framework decision level bugs start emerging.

Then come back as a consultant in 20 years at the intersection of high pay/no
one else can figure out how to fix the software.

If you're working with Java you're mostly in medium pay/tearing hair out coz
of legacy issues-which you WILL have because a Java shop never COMPLETELY
moves to the new thing. Not a fun place to be.

~~~
simion314
>If you're working with Java you're mostly in medium pay/tearing hair out coz
of legacy issues-which you WILL have because a Java shop never COMPLETELY
moves to the new thing. Not a fun place to be.

I am working in the present on Web tech, SPAs, but you know what, it sucks
even if is the cool thin, the project was started with angular1 which is no
longer the cool thing, it uses ES5 and gulp(no longer the cool thing), the
backend uses Silex(a PHP framework that is not that cool) ...

The only cool thing I assume is to start new project in the this month cool
shit and then after 1 year move to the new shiny and let people like me
maintain your inexperienced code in the experimental shiny thing of last
years.

