DEV Community

Ben Halpern
Ben Halpern Subscriber

Posted on

Will Java Trend Towards Obscurity?

I'm forking another conversation:

Word, this is prob a sub topic, but do you ever see anything replacing java?

Yeah, plenty.

Kotlin and Scala come to mind for obvious reasons. Swift, Elixir, Go, Rust, lots of newer stuff which can take Java's place in a lot of contexts where it's popular.

There's a long way to go, but I think Java will gradually trend down and have a lot of different languages take its place. And it will keep evolving and have a place forever. I haven't followed closely but Oracle v. Google can't have helped Java's place in the world.


via Stack Overflow

It seems like JavaScript is the only language with any kind of true moat on its popularity right now because it runs in the browser. And that will go away with WebAssembly.

I think "replace" is a bit too binary a term, but if the line in that graphic keeps going down, Java could easily lose its place as a very popular programming language.

Top comments (55)

Collapse
 
cjbrooks12 profile image
Casey Brooks • Edited

I believe that Java, as a platform, will never die. The JVM and its ecosystem of incredibly high-quality libraries, coupled with its deep roots in large-scale enterprise environments, makes it a worthy platform to develop for and will always continue to live on.

However, I do believe Java as a language will be increasingly replaced by Kotlin. Other JVM languages (Scala, Groovy, Clojure) might have tried to replace Java, but they never really delivered on that promise. They all did wildly different things using Java as a backbone, but simply aren't comfortable to devs used to doing things "the Java way". Scala brought pure functional programming. Groovy made it dynamic. But Kotlin is the first that was actually created to just be a better Java, and by-and-large if you're comfortable writing Java8-style code you'll pick up Kotlin very quickly and fall in love.

But a major part of the success of Kotlin is its perfect interop with Java. Kotlin is great because under-the-hood, it is just Java. There is nothing fundamentally different going on with Kotlin than plain-ol' Java. Both Scala and Groovy have their own runtimes which run on the JVM but aren't entirely compatible with Java. Kotlin just compiles to the exact same thing that Java does, which is a huge advantage for incremental migration, especially in large, slow-moving enterprises.

So, again, Java isn't going anywhere. But I do think it's moving the same direction that C has, being the language that underpins all others. And to that point, Javascript is moving in this same direction as well. It is a sign of maturity of the language, that it has gone from being a language used directly, to being part of the fabric for the next level of technology.

Collapse
 
jbristow profile image
Jon Bristow

The interop is good, but it’s not perfect. It’s especially bad when reflection is involved (see what happens when you deserialize data class Data(val SomeKey:String) with jackson.)

Other problems revolve around functions named to and in and is being unusable in some situations.

Not to mention that one gremlin dsl class named __!

Kotlin is nice, but IMO the interop is less nice than Clojure’s interop or even the F#/C# interop

Collapse
 
pancy profile image
Pan Chasinga

I missed the point of how the interop could be better in Clojure. For one, you can't write serious Clojure for Android, which is a major use case for Java nowadays. What I really disliked when using Clojure interop is that I ended up writing "clunky" Clojure just to fit into Java's way of doing things. Just having to use an object-oriented call from a Lisp syntax feels really messy.

IMO Kotlin has the best interop story so far for everyday use cases.

Thread Thread
 
jbristow profile image
Jon Bristow

True, but I almost never had to just "cast and hope" with clojure calling java code. When it comes to "serious" java (read: "enterprise class" with as much derision as possible) reflection tends to become involved and Kotlin's type system is quite a bit more conservative.

I agree about the awkwardness of

(let [b (SomeBean. )]
  (.setA b a-value)
  (.setB b b-value)
  b)

I tended to hide those away under the rug.

Thread Thread
 
pancy profile image
Pan Chasinga

That was spot on. I love functional programming and Clojure got me for a while until I had to do exactly that.

In my wildest dreams I see Lisp becomes a mainstream language people use to teach and learn programming. I'm still writing Scheme on the side sometimes.

Thread Thread
 
jbristow profile image
Jon Bristow

Tangentially, looking at my let, I saw a familiar construct staring back at me:

val b = SomeBean().apply {
  a = aValue
  b = bValue
}
Thread Thread
 
pancy profile image
Pan Chasinga

LOL. Actually Kotlin stole quite a lot from Scala, which is a functional language inspired by Lisp. So your observation wasn't wrong.

Collapse
 
petarov profile image
Petar G. Petrov

This is a good summary. I'd add to this that Kotlin actually really strives (to me it seems that way at least) to get out of the JVM's headlock. Kotlin Native (LLVM compiled) seems to point exactly in that direction.

Collapse
 
cjbrooks12 profile image
Casey Brooks • Edited

I don't think it's trying to get out of the JVM headlock at all. The Jetbrains team is perfectly happy having Kotlin remain a better Java. I think they just saw a great opportunity to increase popularity of Kotlin by making it possible to reuse code across multiple projects using different tech stacks.

In particular, the adoption for Android made it natural to want to use the same code for iOS, and so Kotlin/Native was born. Likewise, using Kotlin on the server made it natural to want to use the same code on Javascript clients, and so we got Kotlin/JS.

But on both cases, I think the branching into other platforms is driven very strongly by its deep ties to the Java platform, and that will continue to be its bread-and-butter.

Collapse
 
erikthered profile image
Erik Nelson

I think you're spot on with this. The JVM and Java ecosystem are going to around for a LONG time, especially in the enterprise. I doubt we'll see many startups using Java out of the gate, but I can see Kotlin being a nice bridge into JVM-land when you need that kind of power/flexibility.

Collapse
 
bosepchuk profile image
Blaine Osepchuk

I think it depends what you mean by "obscurity."

There are billions of lines of Java out there and while it will almost certainly not be the first choice for new projects 50 years from now, I'm betting that we're still going to be maintaining a lot of that code for the foreseeable future.

Collapse
 
garfbradaz profile image
Gareth Bradley

The COBOL of 2050.

Collapse
 
bosepchuk profile image
Blaine Osepchuk

That's quite likely.

Collapse
 
tiguchi profile image
Thomas Werner • Edited

What I see in that graph is Java's temporary upwards trend we had on Stackoverflow due to the massive popularity and impact of Android. When you add the tag "android" to the mix then you get another graph that illustrates the connection:

trend graph

Then came Google's absurd "API copyright" problems with Oracle and the push towards Kotlin (probably mainly to avoid further costly lawsuits and licensing fee extortion, not so much because the language is so pretty). I think the graph is just going "back to normal again". It's not like it's dipping below the point it was in 2009. But who knows what's going to happen next year :-D

Personally I think Java is here to stay and will go through a few more iterations that will make its syntax less verbose, such as the addition of lambda expressions, method references etc.

Collapse
 
tiguchi profile image
Thomas Werner

Actually after playing with different keywords I noticed that there is overall a downward trend when it comes to questions about mobile app development in general, here a comparison between android and ios and I also added Java and Objective-C for good measure:

Android vs iOS

I was initially thinking that cross-platform development platforms such as React-Native and Flutter are massively on the rise, but it doesn't seem to be the case to such an extent:

alternatives

But there is a significant trend up for web development questions:

webapp trends

Collapse
 
cjbrooks12 profile image
Casey Brooks

I do have to wonder how much of the downward trending of these graphs is actually due to lower interest, or simply the fact that an answer already exists and no longer needs to be asked. Upward trends are definitely indicative of growth, but downward trends...maybe just a mark of maturity and time, not necessarily declining popularity.

Thread Thread
 
tiguchi profile image
Thomas Werner

Interesting thought... A few more factors that might play a role:

  • Android documentation and tutorials have vastly improved over the past few years
  • Stackoverflow is heavily policed. Duplicates are usually closed. Poor questions deleted. I wonder if these are also taken into account in "Stack Overflow Trends"
  • Some questions don't have tags. It's rare, but a search for "android -[android]" (the word android minus the tag android) comes up with 100K results

So yeah, I guess it makes sense that we have reached something like "Q&A saturation" for Android.

I was also wondering something else along the lines... The graph's Y-axis unit is the percentage of all questions asked per month, and not an absolute amount of questions. I assume the amount of questions asked per month changes over time.

Assuming the active Stackoverflow community was also growing over the past few years, I guess we have overall more questions showing up every month compared to a few years ago where Java and Android were in its prime.

Maybe the actual amount of Java questions per month didn't go down, just the relative amount compared to all questions asked on the platform?

We do have more technologies in the mix that play a bigger role in recent years.

But on the other hand... I'm not a data scientist or analyst. I have no idea what all of that means :-D

Thread Thread
 
cjbrooks12 profile image
Casey Brooks

So many questions!!! Now I really want to see a data scientist here write an in-depth analysis of this stuff!

Thread Thread
 
mattmoranjava profile image
Matt Moran • Edited

@Thomas_Iguchi - I think a better metric than "Number of questions asked on StackOverflow" might be "Number of queries run on StackOverflow" - if the subject has reached or is near reaching Q&A saturation then StackOverflow becomes less of a place to ask questions on the subject & more of a place to search for questions that have already been answered. Does StackOverflow publish that kind of data, I wonder?

Thread Thread
 
tiguchi profile image
Thomas Werner

That's interesting... I'm not aware of recorded search queries, but I agree that should definitely complete the picture. How often do people actually search for specific questions and answers. Or a related metric: how often are Q&A's up or down-voted or commented on. Any kind of activity would give some extra insight.

I think this might be possible by using the StackExchange API

Collapse
 
pancy profile image
Pan Chasinga

Great research! What do you think contributes to this upward trend in web dev (despite the mass saying otherwise)?

Thread Thread
 
tiguchi profile image
Thomas Werner • Edited

I think there might be two reasons for the rise in web development questions on Stackoverflow:

First of all - and that's only from my own experience and limited POV - I believe there is growing demand for web development and the initial "mobile app gold rush" may have died down quite a bit.

It is definitely more difficult and pretty costly to reach a wide audience using mobile apps alone. I believe most people are reluctant to install yet another app. They prefer to have just a handful important ones on their phone. Also mobile app users are notoriously cheap. They even feel ripped off when charged a single Dollar for something that is probably worth at least $10.

Hidden rant incoming :-D

When I tried to sell Android mobile apps about 6 or 7 years ago it basically cost me around $1 for a single user acquisition for a free app (via ads, promo campaigns etc.). I guess it would have been easily $5 to $10 per new user for a $1 paid app. Since the market is much more over-saturated now, I guess those acquisition costs went up by quite a bit.

Profit can be only expected once the app makes it into the top 10, or gets promoted and featured by Google or Apple, and even then it's no guarantee.

A game of mine was featured and promoted by the Samsung app store. It was offered for free around the world for a whole week. It didn't make a difference and never turned into a profit. I didn't gain any extra users beyond the ones who got the game for free.

That model doesn't make much sense for most smaller companies with small (or no) marketing budget, especially if the app is free and just ad-driven. It was a losing game. Only the biggest app developers and publishers can reliably turn that into a profit with a big marketing budget and inside connections.

I think for most businesses it probably makes more sense to have primarily a website instead of an app. That also saves them all the complications that come with maintaining and publishing mobile apps:

  • 30% app store sales cut
  • customers expect apps to be for free or at least extremely cheap
  • lengthy, sometimes problematic review process
  • costly user acquisition
  • no direct way to influence store listing as promoted content (unless you have friends at Google or Apple)

end of rant :-D

It is also relatively easy to make a website appear and behave like a mobile app with a bit of CSS magic. That's probably another reason to focus on web first and have a native app as an after thought if really necessary.

But again, I didn't check if there is really a mobile down / web up trend world wide. And my whole rant here is for nothing and I'm probably totally wrong about it.

But here's the other aspect that probably has a stronger impact on web dev questions going up on SO: Vue.JS and even more so ReactJS introduced a bit of a paradigm shift in the ways we think about solving web development problems. It's a shift from imperative to declarative style, which is great in my opinion. But that also raises a lot of questions that need answers.

And then there's the tendency in web development, especially in the frontend development world, to reinvent itself repeatedly. New standards, new tool chains, frameworks and libraries are introduced all the time. Some existing ones change beyond recognition from one major version to the next. That's something I'm not used to in the more slow-paced Java development world where APIs seem to be much more stable (perhaps more thought was put into them ahead of time?).

I'm currently following the react-js tag on StackOverflow and noticed that developers run into the same kinds of problems due to the "latest" shift from component classes to function components with hooks. Function names such as useEffect and their arguments are not really self-explaining or a great example of a well designed API.

It's necessary to either read (and understand) the documentation or stumble into issues and ask for help. We're probably not running out of questions until the tech matures enough so it settles and the only thing we need to focus on is solving business needs and not battle and tame our tools.

So, I guess to sum it up, I see two things causing the rise:

  1. Maybe there's more demand for web development?
  2. Modern web development technology is constantly changing, creating new problems that need answers
Thread Thread
 
pancy profile image
Pan Chasinga

I really appreciate this insightful answer that I'm embarrassed for my reply. Although it's mostly your speculation it's great to hear you share your direct experience in this subject matter.

For me, I've always had friction beginning in mobile dev. I've written some libraries, but the mobile UI paradigm is far too different from the web. It demands so specific skill that iOS and Android engineers have recently become roles companies hire.

I really like the bit you analyzed about the mobile apps craziness vs the web. To add to that, I think during the earlier mobile app hypes most apps that thrived were simple enough to be used on mobile. Now there are services that aren't suitable for it and there's also a shift in the social app trend to more work and life, which require a bit more real estate than a phone's screen.

Thread Thread
 
tiguchi profile image
Thomas Werner

I can totally relate. I took a very long break from mobile app development and find it pretty hard to get back into it mostly because of the UI. I'm also professionally dwelling more in the back end for the last couple of years, mainly writing web services. So yeah those skills definitely get rusty over time.

Funny that you also mention social apps that are getting less suitable for phones. A couple years ago I teamed up with a designer and we started work on a social app / platform. We tried to target mobile devices first and we desperately tried to cram our ideas into that way to small screen real estate. I was very frustrated working on those mobile app UI prototypes, and we faced several hard problems we could not really answer thinking in terms of mobile app UI. It was really limiting. And it also caused a ton of miscommunication between the designer and me.

After a longer break we began revisiting the concept, but I insisted on targeting desktop browsers first. It was completely eye opening for the both of us. We finally got to a point where we could freely express our ideas and discover suitable interaction ways. And we started feeling like: yeah, that's it.

We're taking it from there now, and treat the mobile version as an after thought. In our case I believe that UI enhancements for accessibility will give us some ideas and answers how to handle the smaller mobile phone screen.

If we're lucky and this whole thing turns out to be something, we may end up consulting Android and iOS specialists for fixing our mobile UI writer's block 😆

Collapse
 
oygen87 profile image
Eugen Cazacu

very interesting graphs, thank you

Collapse
 
thebouv profile image
Anthony Bouvier

Enterprise gets mentioned a lot when discussing Java, but tied to that also in non-enterprise environments is anyone doing data science.

Python and R might be the working languages of data science, but the landscape is held up by Java.

Think about all the Apache projects (Hadoop, Kafka, Solr, and so many more) -- those are all written in Java. Those aren't going away or being rewritten or replaced any time soon I don't think.

There's a lot more Java out there running amazing things that lots of devs just don't realize and just fall back on "Java is yucky".

Note: I don't program in Java, but I use a lot of things that are.

Collapse
 
petarov profile image
Petar G. Petrov

Is it this time of the year again? 😉

wiki.c2.com/?JavaIsTheNewCobol

Collapse
 
ben profile image
Ben Halpern

This is generally the sober truth, but......

Java's interop must make with other JVM stuff is definitely notable. And the proprietary Oracle concerns (whether valid or not) sure seems like an extra wrench.

Collapse
 
petarov profile image
Petar G. Petrov • Edited

I would look at the subject also from the geo location perspective. I'm not familiar what the state of Java as a job requirement skill is in North America, but in Europe knowing Java pretty much guaranties you a stable longterm job.

I might be wrong, but I do not see that getting changed anytime soon. Of course, my comment doesn't stand against learning alternative JVM languages, which is what I'm doing at the moment as well.

Collapse
 
elmuerte profile image
Michiel Hendriks

the proprietary Oracle concerns

I think Oracle Legal threw the towel into that ring. Java is only becoming more and more a community owned platform. All commercial features from the original Java distribution have become part OpenJDK which is the default JVM distribution/reference implementation. I think Oracle is going to try to earn money by delivering an alternate Java runtime which is currently named GraalVM. It's open source and free for non-commercial use. It provides a whole bunch of interesting things which companies might be interested in to pay for.

Java as a language is also picking up speed again. Unless JetBrains is going to open Kotlin and make it a community language I think it will eventually lose from new-Java.

If the Oracle/Java debacle showed anything it is that for a single company to try to keep control over a technology can lead to its downfall, or lack of success.

Collapse
 
sake_92 profile image
Sakib Hadžiavdić

Java is dead. Part #834356234 :)
No it's not dead, nor it should be!
Maybe not as concise (yet! but it will be) but a great, great language.
With pattern matching coming, value classes etc. better-java-s gonna lose!

Collapse
 
erikpischel profile image
Erik Pischel

Please also note the new Java release cadence. In the past, it took 3 years or longer for a major release with new language features. Nowadays, every 6 months a new version is released with new features. So Java will add features from other languages in the next years, e.g. record types, value types and fibers. That will make java as a language more competitive again.

The other side of the coin is: will users (like enterprises) keep up with this pace?

Collapse
 
tadman profile image
Scott Tadman • Edited

Java can both grow in popularity and use while also fading relative to other even more popular languages. It can also become so ubiquitous it's invisible, like C.

It's like how Perl is more popular than ever, but has slid a long way from the once dominant position it used to have in the 1990s.

Maybe Java has already slipped into relative obscurity.

Collapse
 
cjbrooks12 profile image
Casey Brooks

It can also become so ubiquitous it's invisible, like C.

Beautifully stated.

Collapse
 
renannobile profile image
Renan Lourençoni Nobile

I agree with Casey, specially the deep roots part. Java, like COBOL, powers a massive amount of software and hardware nowadays. I'm not sure how popular it is for new applications, even more now that Kotlin is in the scene. But here at my job, there are several Java and COBOL applications maintaned and even new programs being created.

I think the "replace" part is due to the fact that startups haven't been using Java for some time now, Rails and the like have chewed the marked and continue to gain popularity.

On the other hand, qualified Java developers, from junior to senior, are a difficult professional to find around here (Brasil).

Collapse
 
awwsmm profile image
Andrew (he/him)

Not if I have any say in the matter

Collapse
 
rhymes profile image
rhymes

Collapse
 
gartboy profile image
Garrett

I really appreciate this gif using the lord of the rings font