Live data from Hacker News

Ask HN: What is a modern Java environment?

news.ycombinator.com

11–20 of 153 posts

Re: Ask HN: What is a modern Java environment?

#11

IntelliJ idea is the best IDE. JDK8 incorporated a lot of great functional programming ideas (though the streams library is awful.). Up through JDK17 there are many improvements including a more scalable runtime. I haven’t been paid to work with Spring since 2013, every project I’ve worked on since has used Guice, maybe Dropwizard. JAX-RS is the dominant paradigm for web back ends these days, particularly if you are…

>I haven’t been paid to work with Spring since 2013, every project I’ve worked on since has used Guice, maybe Dropwizard.

This is the opposite of my experience. I worked with Java a lot for the last 10 years or so. In the last 3 years literally each request I got for implementing stuff in Java also required Spring (Spring Boot) - and that was dozens of clients.

Re: Ask HN: What is a modern Java environment?

#12
My company's product is primarily written in Java. It's a web based auth system, fwiw.

I don't write too much code nowadays, but read a lot. From what I can see, here's the stack:

* intellij for an ide (with tons of plugins)

* prime MVC (https://github.com/prime-framework/prime-mvc) for the framework

* mybatis for SQL/queries

* java 17

I've also used dropwizard and spring. If it was a greenfield development with emphasis on developer productivity, I'd go with spring any day. Big dev community, tons of doco, a solution for any problem if you can find it.

Re: Ask HN: What is a modern Java environment?

#13
* Use SDKMan for runtime and sdk management https://sdkman.io/

* Try to use Kotlin where allowed (Maybe unpopular and bad faith response given that you asked about Java, but I don't care -- kotlin's Java interop is way more seamless than Scala or Clojure to the point that its often not even noticable) https://kotlinlang.org/

* IntelliJ

* Spring is pretty popular, I've seen a lot of people using Vertx

* Square libraries like Okio, okhttp, retrofit, wire https://github.com/square

* If you're not using spring, use Dagger for DI https://dagger.dev/dev-guide/

* Overlook netflix abandonware (another unpopular opinion, I'm sure)

* Use gradle, not maven. Use kotlinscript as the config language, not groovy

Re: Ask HN: What is a modern Java environment?

#14
post #6
post #5

IntelliJ Idea for sure.

Also using IntellJ. But how is the landscape with the other IDE's these days - is NetBeans keeping up?

Netbeans died an unfortunate death once it moved to the Apache foundation and Sun/Oracle funding died out.

https://trends.google.com/trends/explore?date=today%205-y&q=...

Unfortunate, because it had (has?) a great Swing and UML editor, built-in for free.

Maybe I'm wrong and it's awesome now, but I haven't used it for a while in favor of Eclipse, and now, IntelliJ. This graph illustrates the IDE popularity between Intellij and Netbeans. IntelliJ became preferred over Netbeans about mid 2014.

https://trends.google.com/trends/explore?date=all&geo=US&q=i...

Re: Ask HN: What is a modern Java environment?

#15

* Use SDKMan for runtime and sdk management https://sdkman.io/ * Try to use Kotlin where allowed (Maybe unpopular and bad faith response given that you asked about Java, but I don't care -- kotlin's Java interop is way more seamless than Scala or Clojure to the point that its often not even noticable) https://kotlinlang.org/ * IntelliJ * Spring is pretty popular, I've seen a lot of people using Vertx * Square librari…

> Try to use Kotlin where allowed

If you want a slow build and code that is fun to write but hell to read, that is good advice.

> Use kotlinscript as the config language

Extremely slow, that is.

Re: Ask HN: What is a modern Java environment?

#16
post #7
post #5

IntelliJ Idea for sure.

I am using it now because the team is using it, but cant figure out in which way it is supposed to be better then Eclipse. It looks somehow better, but it seems strictly inferior in terms of what it does for me.

And what are the functions that you use that work better in Eclipse?

Re: Ask HN: What is a modern Java environment?

#17
IDE: IntelliJ IDEA https://www.jetbrains.com/idea/

Nothing else seems to come close, they have a Community version, nowadays Eclipse and NetBeans both feel slow but Visual Studio Code with Java plugins lacks refactoring abilities one might expect in an IDE for non-trivial projects. Also, if you get the Ultimate package of their tools, you get all sorts of other useful tools, personally i also enjoy WebStorm and DataGrip for developing front end stuff and working with databases in a separate tool.

JDK: whatever the LTS release of JDK is at the time, based on the kind of work that i do (so JDK 17 now) https://adoptium.net/

As long as you're not stuck with JDK 8, you should be fine in regards to this. But you can definitely enjoy some speed improvements across the releases as well as new language features as well as things like helpful NullPointerException messages. Personally, i'd sometimes also look towards OpenJ9 as an alternate runtime (due to lower memory usage), but that project's future isn't very clear (at least in regards to available container images) last i checked.

As for frameworks, pick one of the following:

  - Spring Boot: mainstay of the Java ecosystem, has a really large amount of integrations and the Boot version also simplifies getting up and running, about as safe of a bet as Rails for Ruby or Django for Python
  - Dropwizard: probably the closest competitor to Spring Boot in my eyes, but is a more loose collection of a variety of pretty much "standard" libraries, has decent developer experience
  - Eclipse Vert.X: pick this if you want to work with reactive programming, last i checked it didn't feel quite feature complete, but the performance numbers speak for themselves, even if it feels a bit niche
  - Quarkus: another modern option that's tailored for the development of performant web services, got a lot of hype in conferences in the past few years
  - Helidon: pretty similar to Quarkus as far as i'm aware (at least as far as the positioning in the market goes) so figured i'd also mention it
In practice, you're most likely to see Spring Boot in existing projects since it's so boring and dependable, though perhaps sometimes you'll also run into the legacy Spring framework (which can be a pain to deal with) or even some of the other ones.

Here's a rough performance comparison if you care about that sort of stuff: https://www.techempower.com/benchmarks/#section=data-r20&hw=...

Build tools: personally, i just use whatever Docker images to base the apps on when available and something like Ansible when not. For the actual toolchain, Maven is still pretty dependable, i guess Gradle is also okay. You might occasionally run into tools like Bazel or Jib, experiences there might vary.

App servers: if you need an application server for some reason (e.g. deploy app as .war), Tomcat is still a good option. If you need the EE functionality (e.g. Java EE which is now Jakarta Java), you might need to reach for something like TomEE or Payara Server, though i haven't needed to do that for a few years at this point, since Spring Boot embeds Tomcat and that is good enough for almost all projects.

Re: Ask HN: What is a modern Java environment?

#19
The stack I've seen, used and liked at many clients is: Spring Boot, Kotlin, IntelliJ.

Which of course means all the old discussions: Jetty/Tomcat/JBoss/GlassFish, GSON/Jackson, Hikari/C3PO/etc, etc are now mostly moot, since most just use the Boot defaults until they need something else. Kinda nice, actually. Less bikeshedding, can get a project up and running without taking a stand on all these things.

Most clients use maven, a few gradle, some used gradle and moved back when no one could understand their config. Gradle might get a second chance now that it can be written using kotlin.

Re: Ask HN: What is a modern Java environment?

#20

* Use SDKMan for runtime and sdk management https://sdkman.io/ * Try to use Kotlin where allowed (Maybe unpopular and bad faith response given that you asked about Java, but I don't care -- kotlin's Java interop is way more seamless than Scala or Clojure to the point that its often not even noticable) https://kotlinlang.org/ * IntelliJ * Spring is pretty popular, I've seen a lot of people using Vertx * Square librari…

Okio is very nice, and Okhttp is quite ergonoic, but I can't recommend Okhttp if true async is on the table (it's just blocking and threadpools under the covers).
Post reply on HN