Live data from Hacker News

Ask HN: Using Java for a web application in 2023

news.ycombinator.com

51–60 of 69 posts

Re: Ask HN: Using Java for a web application in 2023

#51
post #15

I highly recommend either Grails, Spring Boot or Micronaut. There are several others, but they lack documentation, has confusing documentation or is over-engineered. Of these 3, Grails is convention over configuration, and the two others configuration over convention. Micronaut is the most performant and use least memory. Grails has GSP templates, while Spring Boot and Micronaut supports several, but I prefer either…

I developed with Grails some years back and my experience was not that good. It is indeed impressive how fast you can produce a functional first version of an application, but there is price to pay for it. Groovy/Grails contain a lot of (dark) magic which is hard to understand/debug/refactor at times. The generated code (which makes the fast progress possible) needs to be rewritten sooner or later in my experience, so this is not a big time saver in the long run. In my opinion Groovy is just not a good programming language. Kotlin is much better and would also prefer the good old Java.

My personal impression is that Grails lost much of the momentum it had years ago.

Re: Ask HN: Using Java for a web application in 2023

#54
post #4

Would be interesting to see how far a J2EE app will take you on this!

J2EE? The latest version from J2EE is from 2003. It was called Java EE for some years and it is known as Jakarta EE. Almost everything has changed since 2003.

https://en.wikipedia.org/wiki/Jakarta_EE

Re: Ask HN: Using Java for a web application in 2023

#55
post #41

Hacker News is very biased towards the cool new thang. But if you look on StackOverflow Developer Survey 2022, Java is one of the top languages that professional devs actually use in their day to day — far more than Go, Rust, Zig, Elixir, and so on, the more trendy languages that get talked about a lot. The main advantage of Java in my mind is how old, mature, and stable the ecosystem is. Everything has a library for…

> The main advantage of Java in my mind is how old, mature, and stable the ecosystem is. Everything has a library for it.

One challenge here though is that many of those libraries are no longer maintained because the original developers moved away or retired years ago. I have a couple of relatively recent projects which require significant maintenance work dealing with unfixable CVEs or forced major updates which require non-trivial migration. That meant that even using an active project like Solr or Keycloak requires a surprising amount of maintenance developer time.

I don’t think we’ve fully gotten used to the changing supply chain trust situation in open source, and that’s going to hit all of the old ecosystems the hardest.

Re: Ask HN: Using Java for a web application in 2023

#56

Honestly hacker news is the wrong place to ask questions about Java. There is lots of biased opinions with little experience using Java.

I have lots of experience in using Java (Amazon SDE), writing quite a few web services and applications with it, including front end with JSF. As such I can safely say that anyone that thinks Java is good to use for anything these days, especially with things like Log4Shell, simply doesn't know enough about computer science. Java is a poorly designed language with corporate bullshit throughout, and while it may have…

JSF is not my favorite, and I probably wouldn’t use Java for front end applications.

That being said, I think that there is a great ecosystem of great software and tools written for Java. I like learning new languages and techniques, but I find Java is suitable for many things today.

Re: Ask HN: Using Java for a web application in 2023

#57
post #42
post #27

By many metrics it's an excellent choice, but I kind of loathe working with it. However, if you don't mind living in IntelliJ it's significantly better. For example, there's a ton of stuff that doesn't exist, except in IDEland like basic formatting support (this blows my mind). You'll also want an IDE to help you refactor since there's a ton of boilerplate cruft and footguns to avoid. Nonetheless, library support for…

What do you prefer instead of IntelliJ? It's great even for other languages e.g. in Goland and Webstorm. There is formatting support via Gradle and Maven. You can even run prettier via prettier-java. Boilerplate more exists in frameworks especially the older the 1s. You don't have to use it.

Prettier for Java is just terrible! It is super slow and buggy. Use the Google Java Formatter instead.

Re: Ask HN: Using Java for a web application in 2023

#59
post #42
post #27

By many metrics it's an excellent choice, but I kind of loathe working with it. However, if you don't mind living in IntelliJ it's significantly better. For example, there's a ton of stuff that doesn't exist, except in IDEland like basic formatting support (this blows my mind). You'll also want an IDE to help you refactor since there's a ton of boilerplate cruft and footguns to avoid. Nonetheless, library support for…

What do you prefer instead of IntelliJ? It's great even for other languages e.g. in Goland and Webstorm. There is formatting support via Gradle and Maven. You can even run prettier via prettier-java. Boilerplate more exists in frameworks especially the older the 1s. You don't have to use it.

A lot of people get by using lighter weight IDEs or just text-editors for other languages, where a heavyweight IDE is not as necessary. The only thing I miss from IntelliJ when using something else is the debugger. JetBrains debuggers are great, though most editors of passable debuggers these days.

For formatting, the only compelling truly framework agnostic option I know is the google formatter (unconfigurable). The other options are either editor specific (IntelliJ and Eclipse configurations are incompatible go figure), cost money or are half-baked (prettier). Now I believe there's a way to use spotless (tied to gradle/maven) to use one of the IDE specific formatters across IDEs at the build tool level, as you point out, but that's kind of a different thing, heavy weight and working around the underlying problem. Compare this to gofmt, rustfmt, scalafmt, black, prettier/eslint, etc. that are fast, framework agnostic and require no boilerplate. Formatting is a solvable problem in Javaland to a degree, but wow is it unnecessarily complicated and fraught with decision points that can end up in bikeshedding committees.

As for boiler plate, I'm talking about language level stuff, like having to make a class and separate file for every simple data structure, then having to implement hashcode/equals for all those classes, etc. Where in other languages, you can just return a tuple or a result or what have you and get on with your life. Again, IntelliJ will just do most of this for you, but supervising my IDE in boilerplate creation is not a joyful experience. And if you skip supervision, you are basically saying the IDE is now a dependency and the correctness of your program depends on the correctness of your IDE. Not super great.

Anyway, IntelliJ is certainly an amazing piece of software that makes Java development more productive, but learning it, configuring it, etc is a whole thing. Other modern languages provide much better QoL features out of the box and have a much less incidental complexity that don't require an IDE to get around. That said Java has the best library ecosystem, the biggest pool of developers and solid performance.

Re: Ask HN: Using Java for a web application in 2023

#60
post #52

Unless you want a job, there are more lightweight/interesting frameworks than Spring/Boot. e.g. Javalin+JDBI, Quarkus, Micronaut.

Quarkus is more or less in the same complexity league as Spring Boot.

My main issue with Spring/Boot isn't the complexity, it's the ineffectiveness of JPQL/JPA/Hibernate.
Post reply on HN