Remix.run Logo
lukev 3 days ago

More new programs should be written in Java/on the JVM.

Most of the reasons Java dropped out of popularity no longer apply, and at this point it is an incredibly stable and mature ecosystem.

I can come back to a Clojure program I wrote ten years ago and it runs great, meanwhile a TypeScript program I write 6 months ago requires a bunch of updating and cleanup.

Foomf 3 days ago | parent | next [-]

Oracle makes me too uneasy. Can I use Java without the worry of incurring Oracle's wrath? Maybe, if I make sure I use openjdk/jump through some hoops I'll be fine. Or, I could just use any other language and not have that worry looming over me. C# is right there if I want a java-like experience without the anxiety of Oracle breaking my kneecaps.

I don't know how to use java and not violate one of Oracle's EULAs. I could read about it and figure out how to do it safely, or I could just not use java. Java isn't essential (for greenfield projects). There's lots of good alternatives, so I'd rather do that.

samus 3 days ago | parent | next [-]

Just use OpenJDK (only downside is you have to upgrade every half year) or a distribution of another vendor (most people use Eclipse, or Red Hat if they already are Red Hats customers). It's really not as difficult as it is made out to be.

If you use Oracle's distribution of the JDK then you are an enterprise customer and should have the resources to deal with their license terms.

Foomf 3 days ago | parent | next [-]

"Am I using the correct language runtime distribution (or version thereof) so I don't get into legal trouble?" Is a question none of Java's competitors have to ask.

Even using OpenJDK is a sword of damocles waiting to fall. If I forget to update OpenJDK, Oracle could come after me. It's just risk that I don't have to worry about by choosing not to go with Java. It's probably not a lot of risk, but it's risk nonetheless that doesn't exist with Java's competitors.

Competition is so fierce in the language space and there are so many good options that java can't afford to have any friction points like this.

EDIT: I got oracle openjdk and oracle jdk mixed up. They're different things. It looks like the oracle openjdk does not have its license change, the oracle jdk does. This is a problem/risk I don't have to worry about with any other language, but getting the two mixed up is on me.

cbm-vic-20 3 days ago | parent | next [-]

> If I forget to update OpenJDK, Oracle could come after me

I must have missed that section of the GPLv2.

Oracle does distribute a different (not OpenJDK) Java distribution under a special not-open-source no-cost license, which includes a stipulation that you can't use updates after the next LTS release. This only adds to the confusion: you really only need Oracle's special distribution if you want paid Oracle support for it or their stuff that requires it.

munksbeer 3 days ago | parent | prev | next [-]

>Even using OpenJDK is a sword of damocles waiting to fall.

No, it really isn't. Honestly, people seem to go to great lengths of talking nonsense to discredit Java. There are many reasons to not like a language, and that is absolutely fine. But there is no point talking nonsense about it when you could just... not use it.

Foomf 3 days ago | parent [-]

I was under the impression that openjdk changes licenses once a new version comes out. That's why the parent comment said "the only downside to openjdk is you have to upgrade every half year", right?

vips7L 2 days ago | parent | next [-]

No they said that because builds of the OpenJdk codebase by the OpenJdk team are only supported for 6 months until the next version comes out.

Builds of the OpenJdk codebase by other vendors are supported for other lengths of time.

monkeyelite 2 days ago | parent | prev [-]

I don’t think someone can revoke your gpl licensed software you already have.

voxic11 2 days ago | parent [-]

Check out 17 U.S.C. §203 and §304. I think it's possible to revoke the license after 35 years (at least in the US).

brunoborges 2 days ago | parent | prev | next [-]

> "Am I using the correct language runtime distribution (or version thereof) so I don't get into legal trouble?" Is a question none of Java's competitors have to ask.

I am not sure this is 100% true. I think that if you download a specific binary of Anaconda (for Python), you may get into a situation where you have to pay.

For example, at Anaconda.com, one can download their distribution (their build) but the fine print says: "Use of Anaconda’s offerings at an organization of more than 200 employees/contractors requires a paid business license unless your organization is eligible for discounted or free use."

I think that PSF License is permissive and allows binary versions of Python without the maker having to release the source code.

So, downloading Anaconda as a Python distribution (build) is analogous to downloading Oracle JDK (a commercial build of OpenJDK, from Oracle).

thevillagechief 3 days ago | parent | prev | next [-]

This coming from a big Oracle skeptic. None of this is true. There is no practical friction left if you're using OpenJDK. And from the parent comment, you do not need to upgrade every 6 months. Most people just work with the LTS version.

mike_hearn 2 days ago | parent | prev | next [-]

That's because none of Java's competitors have commercial support offerings to begin with, as far as I know?

It's the same situation as with Linux. Red Hat Enterprise Linux isn't free. But it'd be weird if you said you're afraid of using Linux because the licensing is too complicated.

StopDisinfo910 20 hours ago | parent | next [-]

Cloud providers do if you run your program on their platforms. That’s not exactly what you want but that covers a significant part of the market.

lenkite 2 days ago | parent | prev [-]

Lots of languages like Python, NodeJS, C++, even Perl have commercial support offerings.

mike_hearn a day ago | parent [-]

OK but not from the creators of the languages themselves, I think?

The point remains though that it's the same situation. There's a free open source implementation and some companies that offer paid support.

lenkite 14 hours ago | parent | next [-]

Dotnet has commercial support from Microsoft. They are C# inventors.

(Also to needlessly quibble, technically James Gosling under Sun Micro-systems invented Java)

samus 21 hours ago | parent | prev [-]

Pretty sure you can get support from Microsoft or other vendors for their C++ compilers.

mike_hearn 18 hours ago | parent [-]

Microsoft aren't the creators of C++.

lenkite 2 days ago | parent | prev | next [-]

> "Am I using the correct language runtime distribution (or version thereof) so I don't get into legal trouble?" Is a question none of Java's competitors have to ask.

Umm..sorry, but this is just sheer nonsense. There are many commercial Python distributions like ActiveState ActivePython, Anaconda Enterprise, etc that you need to pay for.

If you download and use their prebuilt ActivePython installer without a proper license in a commercial setting, you’re breaching a contract and will get into legal trouble.

> This is a problem/risk I don't have to worry about with any other language,

No, you most certainly DO have to worry about this in many other languages which offer commercial support offerings. (Python/C++/Perl/NodeJS,etc)

> Even using OpenJDK is a sword of damocles waiting to fall.

Just a plain, bald-faced lie.

Quekid5 3 days ago | parent | prev | next [-]

What, exactly, are the JVM's competitors (not Java, btw)? You can always use Kotlin or Scala if they take your fancy. They both interop fantastically with 20+ years of the Java ecosystem.

EDIT: The only remotely competitive ecosystem is JS/TS (because billions of pre-installs) and C#.

> Even using OpenJDK is a sword of damocles waiting to fall. If I forget to update OpenJDK, Oracle could come after me. It's just risk that I don't have to worry about by choosing not to go with Java. It's probably not a lot of risk, but it's risk nonetheless that doesn't exist with Java's competitors.

This is absurd hyperbole.

lukev 3 days ago | parent | prev [-]

> If I forget to update OpenJDK, Oracle could come after me.

What?

Foomf 3 days ago | parent [-]

Licensing for OpenJDK is non trivial. Look at the large table and various bullet points Oracle had to make to tell you the license. https://www.oracle.com/java/technologies/javase/jdk-faqs.htm... (open the first dropdown on their FAQ page to open up their "licensing matrix")

This is a mess, and is the license going to change again while I'm locked in the java ecosystem?

Edit: It looks like the openjdk is consistently under the gplv2, I don't know why it has so many different entries in their table. I think I probably got opendjk and oracle jdk mixed up. I think the person I was replying to who said openjdk needs to be updated every half year got confused as well. It's so hard to even talk about all the different jdks without getting them mixed up or confused. Again, no other java competitors have this problem.

cbm-vic-20 3 days ago | parent | next [-]

Licensing for OpenJDK is trivial (GPLv2+Classpath). Just like gcc/g++ and its runtime library exception.

Licensing for Oracle JDK is more complicated. This is the one where you can use it for free, but after the next LTS you either have to move to the LTS or pay for updates. There's no reason to use Oracle JDK unless you want to pay for support from Oracle, or if your applications specifically require Oracle JDK. Oracle JDK is built from the same source as OpenJDK.

https://blogs.oracle.com/java/post/free-java-license

extraduder_ire 2 days ago | parent [-]

What is even the benefit to using Oracle JDK at this point? Years ago, I saw that some jetbrains IDEs said to use it instead of openJDK, but I haven't seen anything else like that.

lenkite 2 days ago | parent [-]

Oracle JDK offers LTS support with regular security patches and critical bug fixes, even for older LTS releases. (More than a decade plus, I believe, but need to check)

OpenJDK community builds usually only provide updates until the next release (6 months).

Oracle offers paid commercial support contracts: guaranteed patch timelines, 24/7 enterprise support, performance issue troubleshooting, and compliance assurance.

You can also built features atop the Oracle JDK and still get support. SAPJVM does this for instance - hot debugging as a feature.

lenkite 2 days ago | parent | prev [-]

> Licensing for OpenJDK is non trivial.

?? It is very simple. Please go to the OpenJDK site and read the below:

https://openjdk.org/legal/gplv2+ce.html

signal11 2 days ago | parent | prev | next [-]

> only downside is you have to upgrade every half year

LTS OpenJDK distributions from eg Eclipse (17, 21 etc) stick around for longer[1]. Heck, you can still get updates for JDK 11 and even 8.

You do have to update the runtime for security and other fixes, but that’s true for other languages too.

[1] https://adoptium.net/support

stronglikedan 3 days ago | parent | prev [-]

All that just seems like friction when there are frictionless alternatives available. Life's too short for friction.

Quekid5 3 days ago | parent | next [-]

You usually have to explictly opt-in to installing an Oracle JDK because... you know, they have a license agreement that you must agree to.

So there's no friction, everyone uses the OSS ones unless you have very specific needs.

lenkite 2 days ago | parent | prev | next [-]

Can you explain what the friction is ? If you download and install the ActiveState Python distribution in a commercial setting and accept the license agreement without reading and get sued legally at a later point, will you say Python has too much friction ?

Just go to https://openjdk.org/ and click "Download". Or say `brew install openjdk` (macOS) / `apt install openjdk` (linux).

ZERO friction.

samus 2 days ago | parent | prev [-]

There is no friction. Don't use commercial products if you don't want to pay for them. End of story.

brunoborges 2 days ago | parent | prev | next [-]

> Oracle makes me too uneasy. Can I use Java without the worry of incurring Oracle's wrath?

Hey! I work at Microsoft and helped us launch the Microsoft Build of OpenJDK.

I can categorically say that yes you can use Java without worrying. As long as you don't use a commercial binary from a vendor that has certain licensing restrictions.

Our build of OpenJDK is free for any use, and comes with commercial support (you know, the one you can open a ticket and ask us to look into the issue) at no extra cost for workloads on Azure.

GuB-42 3 days ago | parent | prev | next [-]

> C# is right there if I want a java-like experience without the anxiety of Oracle breaking my kneecaps.

Is Microsoft really better than Oracle in that regard?

mrsmrtss 3 days ago | parent | next [-]

If we look at .NET vs Java, then yes, Microsoft is better. Microsoft may charge for some of its dev tools (Visual Studio etc), but .NET itself is and was always totally free.

mdaniel 2 days ago | parent | next [-]

I don't think "was always" is an accurate statement

However, above and beyond free, it is also a collection of ECMA standards https://learn.microsoft.com/en-us/dotnet/fundamentals/standa...

Now, don't get me wrong: I have grave suspicions there is currently only one actual implementation of them (I don't count hobby, or abandonware, ones) but IMHO "actual standard" combined with "for real reference implementation" is way better than just reference implementation

---

since I'm still within the edit window, the MAUI referenced by the sibling comment is MIT licensed https://github.com/dotnet/maui

https://github.com/dotnet/blazor (Apache 2) is marked an archived, and points to https://github.com/dotnet/aspnetcore (MIT) but command-f blazor on its readme is nothing so :shrug:

NekkoDroid 2 days ago | parent [-]

> I don't think "was always" is an accurate statement

If we want to be really pedantic they said ".NET" and not ".NET Framework" or ".NET Core", so basically that what came with .NET 5 and newer.

mdaniel 2 days ago | parent [-]

The very idea of those 3 things being disjoint is a supremely Microsoftian thing to do and makes discussions horrific

HackerThemAll 2 days ago | parent | prev [-]

And .NET is truly cross-platform for 11 years already (since .NET Core 3.0 was released). No licensing/patent/litigation issues since then.

Great GUI cross-platform GUI toolkit (MAUI), great WASM engine (Blazor).

Upcoming .NET 10 is going to be awesome.

NekkoDroid 2 days ago | parent [-]

Isn't the official MAUI still basically "everything but Linux"? I haven't been keeping up with that the last 2 or so years and I just remember there being an unofficial GTK implementation somewhere in the interwebs, but nothing being officially supported on Linux.

HackerThemAll a day ago | parent [-]

Linux desktop has a tiny market share. No reason to invest significant resources for that. Also, by supporting MAUI on Linux, Microsoft would feed their own competition in desktop area, and it's crucial for them to maintain dominance in that area. I think this is why they did not port the great WPF to Linux as well.

And besides, Linux desktop is a mess. I never learned details on how Wayland / X11 / KDE / Gnome etc. work, which is for what. All I know is that some distros switch from one to another, that one is declared the best, and another the worst, and all of it changes regularly. I'm glad someone in Canonical made the desktop mostly working for me in Ubuntu, although it still lacks a lot compared to Windows.

I think when you need that level of cross platform support to cover Windows, Linux, macOS, maybe mobiles, and you do a serious project, you use Qt.

egorfine 2 days ago | parent | prev [-]

Depends. If you were there during the Steve Ballmer time then you know that Microsoft will absolutely betray you on almost every dev tech they roll out.

Otherwise C# and .NET have had a pretty solid track record.

thfuran 3 days ago | parent | prev | next [-]

You don't have to jump through any hoops. If you don't want to deal with Oracle, don't be an enterprise customer of Oracle and instead just get some openjdk distribution.

brunoborges 2 days ago | parent [-]

> just get some openjdk distribution

From several sources:

- Oracle themselves, at jdk.java.net - Microsoft, at microsoft.com/openjdk - Red Hat ... - Azul Systems ... - Amazon - Bell Soft - Canonical (Ubuntu ships OpenJDK binaries built by them) - build yourself?

lenkite 2 days ago | parent [-]

Just go to https://openjdk.org/ and click on the "download" link.

Or use your OS package manager and <pkgManager> install openjdk. Problem solved.

Just like any other software, you know ?

brunoborges 2 days ago | parent [-]

That download link takes you to jdk.java.net, which hosts OpenJDK builds built by Oracle.

lenkite 14 hours ago | parent | next [-]

I don't get it, what is wrong with that ? Those are OpenJDK binaries and also explicitly named as such not Oracle JDK binaries.

ohdeargodno 2 days ago | parent | prev [-]

[dead]

andrewl-hn 3 days ago | parent | prev [-]

My semi-conspiracy theory is that the success of Rust is partially due to BigTech companies searching for a "legally-safe" alternative to Java.

The multi-year Google vs Oracle lawsuit put the likes of Amazon and Facebook to unease. And meanwhile there was this safe and performant language with no strings attached under a nice Apache license. They quickly made a Foundation around it as a 501(c)(6) - trade association, and not a "public good"-kind of a non-profit. This essentially means that as long as you're a member and pay the fees you won't be sued - exactly what all these companies wanted. So now they all keep up the funding and employ some of the compiler developers to keep the lights on for next 20 years or longer.

The fact that the language itself is really good for what they need it for is obviously the major reason why they support it, but the legal side of things definitely helped with adoption.

nirvdrum 2 days ago | parent | next [-]

I'm not sure where things fall on your timeline, but in case you missed it, Amazon has their own Java distribution called Corretto. It was first publicly released in 2018:

https://downloads.corretto.aws/#/overview

HackerThemAll 2 days ago | parent | prev [-]

This conspiracy theory would explain not only success of Rust, but also Go language and C#/.NET, and any other Java competitor.

I'd say it's 90% because of Oracle and its lawyer-driven business, and 10% because the language is just ugly, and existing libraries are super-ugly and unreadable, with all these Factories and AbstractFactories, and all design patterns forced like a religion whether they're useful or not in a specific context.

cgh 3 days ago | parent | prev | next [-]

Java is hugely popular and widely used on large backend systems. I guess a lot of people here don't work on such systems? I'm always surprised when I see comments like the parent, since in my career exposure to Java is near-ubiquitous.

Noe2097 3 days ago | parent | next [-]

There has been a move in the past 8 years away from Java on the back end, notably to Go, by several large engineering organizations, which made the move, "motivated" by the example of companies like Google or by projects like Kubernetes, and seduced by the promises of a language simple to learn, build, and deploy.

p2detar 3 days ago | parent | next [-]

> seduced by the promises of a language simple to learn, build, and deploy

That's actually quite correct and I'm saying this as someone that does Java on daily basis. Go is in fact superior in terms of deployment. I would rather deploy a Go-written service than a Spring Boot one. That being said, I love using Java for monoliths - large code bases crammed with business logic. I personally don't see Go doing very well in that direction.

Tostino 2 days ago | parent | next [-]

What deployment challenges have you had with Java / spring boot apps? It has been totally smooth sailing for me.

makapuf 3 days ago | parent | prev [-]

Why is it so ? Is go specifically lacking somewhere ?

lenkite 2 days ago | parent | next [-]

Businesses often deal with old databases, message queues, SOAP services, legacy systems. Java has a truckload of well-established connectors (Even more than Python!), well-supported JDBC drivers, and vendor-supported SDKs.

Also features like transaction management, dependency injection, validation frameworks, AOP-style cross-cutting concerns are better addressed in Java.

Java has collection streams with great customizability (filter/map/reduce/etc). Far better writing your 10,000th for-loop in Go. You can also get automatic parallel streams without writing any extra code.

Go's profiling tools (esp memory) are very primitive, sorry. JVM profiling tools beat Go's by orders of magnitude. So does the other tooling - GC tuning, monitoring, etc. Java flight recorder and VisualVM are gorgeous.

That said, Go is still better at memory efficient, tight network software like lean k8s controllers. Though frankly, Rust is encroaching into this space.

mdaniel 2 days ago | parent | prev [-]

I'm not them, but there are few things better for operational insight than the JVM. It has a boatload of tuneables, it has a very rich dynamic code load mechanism (Reflection, ClassLoaders, the new Modules system, and it used to have a strong sandboxing system but they killed that), and at the intersection of those two things is JMX, which is dynamically tuneable deployments via API. It's like having JVM-local feature-flags that one can twiddle without needing to bring down the JVM

And sure, it's not everyone's cup of tea, and/or plenty of people will chime in with "yes, but"s to defend golang or every other platform that isn't the JVM. I'm not yucking your yum! I'm just saying for me, the JVM is the bees knees

Quekid5 3 days ago | parent | prev | next [-]

Go is slowly becoming Java 1.5+ -- see the addition of generics.

Btw, you can AOT compile Java if you wish... it'll probably be a larger binary than a Go binary, but that's whatever...

[Meta] ... God, I'm turning in pjlmp here, lol

kccqzy 2 days ago | parent | prev | next [-]

Creators of Go within Google conveniently left out the fact that within Google there's still far more Java code than Go code.

re-thc 2 days ago | parent | prev [-]

> by several large engineering organizations, which made the move

The problem with this type of trend is it's often hype and you never know what actually happens or how does it evolve over time.

I've seen organizations make certain announcements, switch maybe 5%, give up and go in different directions, but only the initial announcement ever hit the news.

> and seduced by the promises of a language simple to learn, build, and deploy

It's always simple if you rip it all up. Nice and shiny toys are always great.

belter 3 days ago | parent | prev | next [-]

Most of the largest cloud was built on Java....

SoKamil 3 days ago | parent | prev | next [-]

I suppose we are talking about user-facing desktop software.

lisbbb 2 days ago | parent | prev [-]

I think the rise of containers and being able to compile and run natively has eliminated the argument that would favor the JVM. It's so easy to fully control your dev and deployment environments now using Docker images and to me, that's a far better solution. tl;dr -- containers eliminate Java long term.

re-thc 2 days ago | parent [-]

> tl;dr -- containers eliminate Java long term

Why can't they co-exist?

> has eliminated the argument that would favor the JVM

This complaint is taking technology definitions too literally. I doubt new adopters of Java or the JVM are really going on about that now. It's more been about the ecosystem, the maturity, etc.

fnord77 3 days ago | parent | prev | next [-]

I think Java is the best language for most medium to large projects or anything that requires threading or complicated/optimized IO

Especially now that hardware architectures are getting fragmented again, I hope it becomes more relevant.

I think Springframework is dragging Java's reputation down. I know Spring boot is better but it's such a monstrosity.

I feel like sadly Python has won the war, though. Good enough for most things even though it is pretty rubbish.

I see people trying to use Rust now for prod AI systems.

lisbbb 2 days ago | parent | next [-]

With over 20 years working with Java, I'd much prefer working on Python for lots of reasons, but a big one is that the kinds of projects that involve Java are always involve the same stupid politics and organizational struggles. I've noticed that projects involving Python are way more enjoyable with less friction, likely due to the organizations themselves being more open-minded and maybe younger. I don't know. At some point, every Java project at every Fortune 500 company I worked with was the same damn hellish mess and I had to get away from that.

re-thc 2 days ago | parent | prev [-]

> I think Java is the best language for most medium to large projects

With this in context...

> I think Springframework is dragging Java's reputation down. I know Spring boot is better but it's such a monstrosity.

Is that really so? Spring's not the best, but it's definitely better in medium / large environments than a lot of other 1s. There are way more train wrecks to maintain that especially don't have any documentation or the libraries have gone dead.

palata 3 days ago | parent | prev | next [-]

I'm secretly hoping that Kotlin and Compose will bring back Desktop apps on the JVM :-).

jareds 3 days ago | parent | next [-]

I'm rooting against Kotlin since it appears to be only usable with the JetBrains ide. I'm totally blind and Jetbrains tools are not nearly as accessible or easy to use as VS Code with all the Java extensions in my experience. At all the jobs I've had no one cared if I didn't use Idea, but considering it looks like there's no good VS Code tooling for Kotlin if I have to use Kotlin professionally it's going to be painful.

palata 3 days ago | parent | next [-]

Oh I didn't know about that. Is JetBrains improving on accessibility, at least, or not really?

mdaniel 2 days ago | parent [-]

What's unexpected about that observation is that they have actually completely separated the presentation layer from the business logic because such a thing was required to have "Code with Me" and their "projector" project wherein one could use IJ from a browser https://jetbrains.github.io/projector-client/mkdocs/latest/a...

But, I am fully talking out of school because I don't know what the actual, no kidding, accessibility hurdles one faces when trying to do work in such a setup, nor what concessions VS Code has made to fix those problems

But I do know that YouTrack has a dedicated categorization for accessibility reports and I am sure they would welcome hearing about how they could win back those audiences https://youtrack.jetbrains.com/issues?q=%23%7BUI.%20Accessib...

jareds a day ago | parent [-]

My major issue is that the IDE doesn't use the same hotkeys or similar interface to VS Code. This isn't necessarily a problem, but the fact that it's so different means the learning curve is absolutely brutal so it's not worth the effort for me to look at it. If there was a basic getting started tutorial that walked you through building a simple program, finding and fixing compilation errors, performing basic debugging etc, that was written from the perspective of a screen reader user that would be incredibly helpful. Something like this may exist, but if it does I haven't found it.

ohdeargodno 3 days ago | parent | prev [-]

As of somewhat recently, Kotlin has a language server: https://github.com/Kotlin/kotlin-lsp

Using it in vscode, while not perfect yet, is starting to be alright.

jareds 3 days ago | parent [-]

Thanks, I've starred the project so I can keep up with it. I don't currently have any plans to do anything with Kotlin but will look at this if I do in the future.

deepsun 3 days ago | parent | prev [-]

I write desktop app on JavaFX (one Kotlin one pure Java). I don't see any problems why we should wait, it's production ready

palata 3 days ago | parent [-]

I mean, I agree that it is really good! I'm just hoping that it will come in fashion, versus those ElectronJS... things.

pgwhalen 3 days ago | parent | prev | next [-]

Java's biggest risk towards continued adoption, by far, is the culture surrounding it - old Java programmers and old Java programs continue to be needlessly verbose, even if the language now has the tools (pretty much) to be as terse as other popular, modern languages.

It's an uphill battle, but it might just climb the hill because it's still such a behemoth.

eastbound 2 days ago | parent [-]

It all failed when .stream() appeared. Why make people use .stream() for functional programming, plus streams aren’t even reusable, I almost wish they invented a new operator based on an exotic UTF-8 character than those 9 extra characters. Fonts should have a ligature for .stream().

And now let’s talk about .collect(toList())…

And records which look like ugly beans…

Java is the land of the verbose. But it can probably be solved with 9 extra characters on every line.

lenkite 2 days ago | parent | next [-]

Nobody complains about the Rust turbo-fish operator which is pretty verbose too. Java has already has introduced a direct toList()/toArray() anyways.

    let v = (1..5).collect::<Vec<i32>>(); // Cool Rust
eastbound a day ago | parent [-]

Streams should be built in collections, not a .stream().map(…).toList() convolution. In know its incompatible with weird frameworks who already overloaded the .map() method, but well… let them recompile.

That was in 2008, we’d be happy by now; and Java had no qualms asking everyone to change the package names from javax’ to jakartax’ in Java 21, so they should have issued a java.collections package and deprecated the lists i java.utils.

erkkonet 2 days ago | parent | prev | next [-]

starting with JDK 16, Stream has .toList() that will save you ten characters for the .collect()

never_inline 2 days ago | parent | prev [-]

It's very difficult for a language designer to satisify the aesthetes.

iLemming 3 days ago | parent | prev | next [-]

> I can come back to a Clojure program I wrote ten years ago and it runs great

Is that thanks to JVM or due to the way how Clojure works? Because I can share the same anecdotes for my Clojurescript projects. I can grab any old nbb script and things just work off the bat - sometimes I have to update some npm dependency, but most of the time, things simply aren't horribly broken. Meanwhile, I just spent half a day jumping around for weird Python dependency and venv magic dance, just for the sake of running five interdependent scripts.

kccqzy 2 days ago | parent | next [-]

It's not clear whether the author built the Clojure program into a jar or not. If so, it would be thanks to the JVM.

In any case, the dominant way people build Clojure has changed. Ten years ago it probably used lein. Nowadays a new project will probably use deps.edn.

devgoth 2 days ago | parent | prev [-]

i think this is because of Clojure's mentality on backwards compatibility and not the JVM specifically. please someone correct me if im wrong tho!

iLemming 2 days ago | parent [-]

I feel there's much more to it. There are so many pieces in Clojure that just feel like they're done right. Even after a decade of using it, I remain happy. Not a single other language (and I tried more than a few) has kept me happy for so long.

wry_discontent 3 days ago | parent | prev | next [-]

In the circles I see, Java isn't popular because it's verbose and boring to use.

These days I don't see those as significant issues, tbh.

I would prefer a Clojure program, but I'll take Java over Typescript at this point.

Sohcahtoa82 3 days ago | parent [-]

> it's verbose and boring to use.

Python code that follows traditional Python paradigms is called "Pythonic".

Java code that follows Java paradigms is called "awful".

To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.

Endless levels of abstraction. The apparent inability to write a simple function and instead creating a "ThingDoer" class with a single function called "doThing". Run-time introspection and reflection EVERYWHERE. Stack traces that are just an endless stack of calls to functions like ".invoke" and ".run".

I've been under the impression that all of that is a by-product of Java's strict type system, but someone please correct me. Why do Java paradigms seem so awful?

mike_hearn 2 days ago | parent | next [-]

Well, there are lots of people out there who view "Pythonic" as a euphemism for awful tbh. Throughout my career I've seen multiple large Python codebases be rewritten in Java after they turned into a mess, including - perhaps most embarrassingly - Google's internal code review tool Mondrian, which was written by Guido van Rossum himself.

One reason Java codebases feel more abstract is that they're attempting to solve problems that the scripting worlds tend to just punt on, or handle in ways that don't scale well. And because Java's type system is nominal, solutions to those problems require names.

For example, a lot of the abstraction in Java codebases is to make things deeply testable. That's what drives dependency injection, which is where a lot of BeanFactory stuff comes from. What's the Python solution to that problem? Often they just hardly have tests by the standard of Java developers! This is why Python is big in ML research where codebases are often small disposable experiments, and why after a brief era where Django was popular it sort of died off in the wider server / big data space.

Another source of complexity and abstraction is a focus on pluggable ecosystems. Databases are abstracted by JDBC, and then again by an ORM, which then might be abstracted again by Micronaut or Spring, and at each layer there are multiple competing implementations available which implement standard APIs. This kind of thing happens much less in the scripting world. The downside is that scripting codebases are far more locked-in to their choice of libraries. Porting a Java codebase from one database or ORM to another is hugely easier, because the core APIs are all standardized.

sorokod 3 days ago | parent | prev | next [-]

It's a culture, not language thing. Here is a JSON parser implementation (part of PlantUML) that lacks endless levels of abstraction.

https://github.com/plantuml/plantuml/blob/master/src/main/ja...

porridgeraisin 3 days ago | parent [-]

I'd argue culture solely defines the language.

Is there a full library ecosystem of stuff written like the json parser you shared, which is as complete as the enterprisey library ecosystem? Similarly, SO answers? LLM output? Tutorials? YouTube videos?

I think the answer is no.

It's the same problem with C#. Just adding alternate paradigms means nothing. The only thing that matters is how a majority of code in the ecosystem is structured. In java, that's enterprisey code. Most code is glue code, so you're forced into the majority pattern, lest you want to write endless wrappers...

On the other hand, while typescript supports a lot of the enterprisey nonsense similar to C#, the majority of the ecosystem is written with simple functions, callbacks and options objects. Not in an enterprisey way. I don't need to use decorators to use zod.

People that eschew enterprisey code and prefer simple code can't switch to java or c# until the whole culture changes, regardless of the kitchen sink of features either language adds.

zerkten 2 days ago | parent | next [-]

>> On the other hand, while typescript supports a lot of the enterprisey nonsense similar to C#, the majority of the ecosystem is written with simple functions, callbacks and options objects. Not in an enterprisey way.

Going back to culture, who makes up the Typescript community? While C# devs are attracted to it there are many multiples more devs coming from a JavaScript background. This has a big impact on how the culture developed.

Taking a step back. C# devs often need to do frontend work. They could go with what the industry has settled on, React, or go another way. The bulk go with react and some perhaps lament still have to switch their brain to another mode for that work. Frontend is obviously more fragmented, but the scale prevents C# devs from influencing patterns to the extent that they do on the backend.

I'd argue similar for Java devs when it comes to frontend. In the case of Blazor, I think C# patterns are a much smaller factor in decision-making. In fact, lots of C# adherents would default to React given it's the industry standard.

sorokod 3 days ago | parent | prev | next [-]

I agree with most of what you are saying except for the "solely defines" bit. The culture is a powerful force but individuals are free to make choices and the language allows for these choices.

troupo 2 days ago | parent | prev | next [-]

> It's the same problem with C#. Just adding alternate paradigms means nothing.

C# is still much better because it has a lot of useful DX improvements: from object initializers to IEnumerable everywhere. It keeps the tower of abstractions lower, and makes working with the tower a better experience.

Though I've only worked on microservices written in C# in .net core

Mawr 3 days ago | parent | prev [-]

Spot on. You can't separate a language from the speakers of it. You can't redo millions of hours of work put into an ecosystem.

johnyzee 3 days ago | parent | prev | next [-]

Those are not Java paradigms per se - they're just practices of mediocre enterprise developers, of which Java has many, owing to being such a mainstream platform.

As for the language itself, a lot of verbosity has been culled in later language versions, with diamond operators, lambda expressions, local variable type inference, etc.

In either case, code is read more than it is written, so if a bit of verbosity makes code easier to read, I'm okay with it.

cmrdporcupine 3 days ago | parent | prev | next [-]

As others are saying, it's a culture not the language. C++ and even some Python etc written in the late 90s, 00s era has the same pattern-itis. It comes from slavish adherence to the Gang Of Four patterns books and an obsession with OO generally. Also the languages themselves were weak on non-OO abstractions and ways of doing code re-use, so for example it took forever for Java to get lambda expressions ... so people used one-off helper classes with "invoke" methods, etc.

kbolino 3 days ago | parent | prev | next [-]

ThingDoer.doThing was often just functional programming squeezed into an object-oriented straightjacket. Java 8 added first-class functions and lambdas over a decade ago, eliminating a lot of the need to turn simple behavior into full-blown classes.

cryptos 3 days ago | parent | prev | next [-]

One reason for that Java style is that Java was not such a powerful language for a long time. For example lambda expressions were only introduced in Java 8 (2014) and before that developers need to work around this restriction. A common workaround were/are some annotations above of methods and some reflection magic on top. For example a life cycle callback method annotated with @PrePersist is basically the same a registering a _function_. The whole Lombok library is a massive hack to circumvent some inconveniences in Java (and in my opinion no longer needed).

robmccoll 3 days ago | parent | prev | next [-]

I think a lot of it is the people using it and certain parts of the culture. There are a lot of Enterprise TM programmers that seem to believe as many layers of abstraction and as much verbosity as possible with little tiny methods that do practically nothing leads to better solutions. It is totally possible to write concise and pragmatic code with Java. One thing that will be a thorn in your side though is null handling. The traditional approaches increase line count and branching. The newer(ish) Optional-based null handling is quite verbose but in width.

ifwinterco 3 days ago | parent [-]

In my opinion at this point null handling is the one remaining thing about Java that is genuinely bad technically

munksbeer 2 days ago | parent [-]

I haven't seen a NPE in the wild for years. We use NullAway in our build - works great.

lab14 3 days ago | parent | prev | next [-]

I think it doesn't have to be like that, but it's the way Java code has been written for ages, so those habits stuck. You can see it clearly when you bring a Java programmer to collaborate on a Ruby or Python codebase, if you let them, the will turn your codebase into an enterprise-ready mess with layers on top of layers of indirection in a blink.

never_inline 2 days ago | parent | prev | next [-]

> by-product of Java's strict type system

1. Lack of first class functions till Java 8 is one reason old APIs are horrible with inheritance and reflection everywhere. You had to extend class and override methods even for simplest of tasks.

After Java 11 the code is much more succinct and functional style. But old libraries remain.

There are places where the overextensibility these libraries provide is useful. But those are few.

2. the annotation processors were late to the game - so many libraries which need to inspect object structure (such as serialization) were written with heavy use of reflection.

I will give you an example of how frameworks designed for "modern" Java look like.

Micronaut has something called Micronaut data JDBC - in which you just declare methods with few annotations eg `List<Book> queryTop10BooksByYear(int year)` and it will auto generate the JDBC + SQL code and handle injecting it into your service. The returned object can be a POJO without all the Proxy object circus ORMs come with. I haven't seen something as easy in Python yet. And all this happens in compile time with an annotation processor.

microflash 3 days ago | parent | prev | next [-]

As someone who has seen awful code in pretty much every language I've worked with, I'd blame this more on inertia and reluctance to change habits. The bad patterns that have entrenched deep into the ecosystem are very hard to shed even when the language and platform is making progress at impressive speed.

lock1 3 days ago | parent | prev [-]

As other sibling comments have said, it's cultural. Fortunately, there's some push toward functional & ADT-style modelling in the Java community and they've decided to call it "data-oriented programming" for some reason.

Eh, I don't think Java type system is strict, nor is it the root cause of this cargo cult mess. It's probably due to many enterprise programmers who think design patterns are the building blocks of everything rather than an invisible, emergent structure.

sunshowers 3 days ago | parent | prev | next [-]

Java has the same problem most imperative languages do, which is the lack of clear separation between mutable and immutable state, rigorously enforced by tooling. Many large-scale Java programs try and work around this by using immutable collections, which certainly makes a difference but can only go so far.

Java has the additional issue of being object-oriented, which leads to spaghetti parent-child relationships under stress.

symaxian 2 days ago | parent [-]

Valhalla should be able to address this to some extent with immutable value classes.

Decabytes 3 days ago | parent | prev | next [-]

My biggest Issue with Java, is that it isn't streamlined. There are multiple implementations of the jdk that could be used, Many different build systems, etc. The C# ecosystem is smaller for sure, but it is much more streamlined

waldarbeiter 3 days ago | parent [-]

The different JDK builds are almost all built from OpenJDK. Maven and Gradle cover nearly all use cases. The complexity is not that high.

giobox 2 days ago | parent [-]

I think it is quite high, especially for newcomers to the ecosystem. The popular sdkman CLI tool for managing JDK installations provides 17 different JDKs to install:

https://sdkman.io/jdks/

With the DotNet SDK for comparisons sake, there is but one provider, and package management is provided as first class citizen in the compiler CLI, removing the need to even pick a "gradle" or "maven" style build tool in the first place for almost any project.

Eldt 2 days ago | parent [-]

At the very top of the page it mentions a default which kind of negates that issue...

giobox 2 days ago | parent [-]

It doesn’t negate the issue at all, especially as sdkman is an optional extra tool. If working with others, that default is not always going to be the one your team develops against either. If you are just trying to pick a jdk and don’t even know sdkman exists, a sensible person will rightly wonder why the ecosystem has fractured into 17 JDKs, or you won’t notice at all and blindly pick a download from the oracle website. I’ve seen it cause confusion many times for new (and old!) Java developers.

Checking a new developer has actually managed to install the correct JDK for a given project is still a thing I have to do, all the time.

Sdkmans docs also have no bearing on the multiple build systems in the java world too, which again simply a non-issue in DotNet and many others.

AzzieElbab 3 days ago | parent | prev | next [-]

It is probably more related to people replacing multithreaded services with single-threaded workers.

AlienRobot 3 days ago | parent | prev | next [-]

I've been trying Java recently with IntelliJ and it's been funny watching Java's evolution from the IDE's suggestions.

In Java a lot of code looks like this

    void foo(Bar bar);
where Bar is an interface, and in many cases it only has one single method, so it looks like a callback that must be wrapped inside a class. Fortunately, Java lets you create anonymous classes to use these methods.

    void foo(new Bar { @override boolean baz(Fish fish) { return false; } });
I assume because this paradigm is so common somewhere along the way Java introduced "lambdas" that look like this (I learned this from an IDE hint)

    foo((Fish fish) -> false);
But what if you have a class that has Bar.baz method signature but it's called something else like fries()? Turns out you can do this (another IntelliJ hint):

    foo(this::fries);
This feels like a complicated way to declare a callback, but it means that if you do implement a method with the same name, you can just pass the instance, otherwise you can use the syntax sugar, e.g.

   saveMenuItem.registerMenuClickListener(myMenuClickHandler);
   saveButton.registerClickListener(myMenuClickHandler::onMenuClick);
There is a lot in Java that just feels weird, though. From the top of my head:

1. No unsigned integers. "byte" is -127 to 128. I believe this means it's not straightforward to make a 32-bit RGBA structure since you options are either using a signed "red" or using a 16-bit integer to store the 8-bit values. by the way I tried to benchmark how slow Java was compared to C in a simple test (I had arr1[] with indexes of arr2[] which contained values and I created arr3[] by resolving them) and it seems to be only half the speed of C which is probably fast enough for some basic low-level 2D graphics.

2. String.split takes a regex argument and there is no standard way to split without a regex. This was really confusing to me, but fortunately it's very easy to write your own .split, so it's not that much of a big deal.

3. You can call a different constructor with this(), but it has to be the first statement in the constructor. This one is pretty crazy! It would make sense if you couldn't access member fields before calling the constructor, but having to be first statement means if you want to calculate the argument for one constructor based on an argument passed to another constructor you need to do it inside the parentheses.

So far there is only 2 things I wish Java had. First the ability to implement methods in interfaces so you could use them if you have an interface instead of using a static method. Second I wish @NotNull was the default. This is a problem that Kotlin fixes so I think if you like Typescript for tis type-safety learning Kotlin would be a good idea.

ludovicianul 2 days ago | parent | next [-]

Java is really fast: https://github.com/gunnarmorling/1brc

mnembrini 3 days ago | parent | prev | next [-]

2 yes, although if you are splitting only one regular character the implementation doesn't use a Regen internally

3 is not an issue anymore since java 22 https://blog.jetbrains.com/idea/2024/02/constructor-makeover...

thfuran 3 days ago | parent | prev | next [-]

Doesn't java now let you have both private methods in interfaces and default implementations of the interface methods?

mdaniel 2 days ago | parent [-]

    $ cat Foo.java
    interface Foo {
        private String jimbo() {
            return "yup";
        }
    }

    $ javap -c -private Foo
    Compiled from "Foo.java"
    interface Foo {
      private java.lang.String jimbo();
        Code:
           0: ldc           #1                  // String yup
           2: areturn
    }
and

    interface Bar {
      default boolean isAwesome() {
        return true;
      }
    }
ohdeargodno 2 days ago | parent | prev [-]

[dead]

lisbbb 2 days ago | parent | prev [-]

After working with it for over 20 years, I think it's time has come and gone and that it's not the most efficient way to build enterprise applications anymore. You're lucky that Clojure program still works on the newer JVM because many of the applications I worked on, which were very large, could not be migrated to newer versions of Java. In fact, that experience repeated several times for me. I barely ever worked on anything that used the latest versions of the JVM, every place I worked was always on things like "Java 8" and crap like that. It was infuriating, but the situations were not unique at all.

tpm 2 days ago | parent [-]

We built an app in Java 8 a few years ago and are updating it for each LTS version, currently 21. Except for a few issues like the renaming of Javax packages to Jakarta it was pretty smooth so far.