When You Get Jealous of Other Languages

Jesse Anderson
97 Things
Published in
2 min readJun 7, 2019

I started using Java in the mid 90s. To date myself, I was still in high school at the time. If you were to transport my high school self forward in time and show me modern Java code, I would ask:

  • What happened to applets? I thought those would take over the world.
  • What happened to AWT? Why aren’t we using more cross-platform Java UIs?
  • What are those weird things with less than and greater than signs around them? Why is there a class inside of them?

To answer my first two questions, you’d have to explain what the web became and how the web became the cross-platform UI. To answer my last question, you’d have to explain what generics are and why they’re necessary.

There’s one other important syntax difference since Java 8, and that’s lambda expressions. Those are handy for data processing or running the same code on an array in a concise manner. It helps with Java’s notoriously verbose code.

That said, you could explain a decade or two of Java syntax changes in about an hour or two — and you might say that’s a good thing. Our past selves are always time-traveling and we need to make sure our languages don’t change too much, but I can’t think of a reason why Java syntax isn’t evolving more.

But here’s the problem. You couldn’t explain some other languages’ syntax changes so easily because they’ve actually moved and changed and greatly improved over the last decade and a half. It would take many hours — or even days — to absorb those languages’ syntax changes over the years.

And that’s when I get jealous of other languages. I start to long for Python’s ability to have multiple return values and directly assign multiple return values to different variables. That kind of sorcery makes me think, Wow, that’s cool, why don’t we have that in Java?

I see other nifty syntax like Groovy’s Elvis operator, Scala’s case class, etc., and I start Googling around to figure out why such syntax features aren’t in Java. And I realize we’re not going to see them for another 15 years.

On the one hand, the community has conceded these language deficiencies and has come to our aid. For example, there’s Scala, Clojure, Groovy, JRuby, Jython, and Kotlin. But on the other hand, to use them we have to learn entirely new syntax and traverse the gray area where some of these projects are no longer alive or maintained.

Then you come back to: Why doesn’t Java just add more syntactic sugar to begin with?

I see you there thinking about the Python 2.x to 3.x switchover. That was when the syntax changed, and your code could still run (but not always), but the syntax changes could make your program no longer function correctly — at runtime, mind you! Next time you get jealous of Java not changing, remember the minefield it can be. Maybe fewer syntax changes are a good thing.

--

--