Live data from Hacker News

Ask HN: What is a modern Java environment?

news.ycombinator.com

71–80 of 153 posts

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

#71
Along with the various other libraries and frameworks mentioned;

* Testcontainers - seamless support for using Docker in integration tests [1]

* Project Reactor - nice framework for reactive programming [2]

* Executable Jars - No need to deploy a War file to a servlet container anymore. Build an executable Jar with an embedded container. Spring Boot makes this very easy

1. https://www.testcontainers.org

2. https://projectreactor.io

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

#72

Earlier quoted context omitted.

The reason I'm being terse with you and perhaps a bit rude is that you started this reply thread by insulting my opinions for no reason and then continued to reply with what I believe to be both bad faith readings of my comments and naturally argumentative. I know HN values skepticism, but honestly it's tiresome. Anyways, here's my clarifying my previous comment. Please keep in mind that I fully expect you to read th…

So Java isn't on thin ice if it's used heavily.

What do you want to hear? That you're right? Communication is a two way street, try treating it like one. "To be on thin ice" is an expression which means in a precarious or risky situation, but is commonly used in reference to personal regard or favor. !!!!!!YOU'RE RIGHT!!!! (congratulations!) Java is not at risk of falling out of use - it's a very heavily used language with lots of job opportunities. Congratulations again on being technically correct. If that's all you wanted stop reading.

I'm saying that writing, maintaining and deploying Java in a manner that is fast, pleasant, sustainable, performant and desirable for developers is already at risk, in my opinion. As a developer, Java is *not* the best solution and taking away the niceties listed puts Java in a place where it is at risk of being unsuitable for the task. This isn't solely a fault of Java, some of this is simply better solutions for problems existing around Java. Java moved quite slowly for a long time and solutions filled that gap. I understand a business' desire to have a uniform programming language that they can hire for, but these days languages look very similar and polyglotism isn't that hard to find. Choosing the right language for the task is an engineering decision just like preserving language uniformity is. I don't think either is wrong, but the more people try to make Java a place that is worse than it's competitors, the more I'll favor choosing a different right language over preserving uniformity. I hope this helps clarify what I saw to be an extremely benign opinion to voice.

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

#73

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…

Yes. Perhaps to add to this, use a modern asynchronous IO framework. If you use Spring Boot, ignore some of the legacy stuff that still comes with it and make sure you use webflux with Kotlin co-routines. Also use Asynchronous IO for talking to your database, queues, etc. Kotlin makes all of this easy. Hibernate is something I tend to avoid for various reasons but apparently recent versions of that now also support a…

I don't consider synchronous programming as being legacy.

For many projects synchronous programming can work just fine, and it lowers complexity.

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

#76

Earlier quoted context omitted.

I'd suggest using koin instead of Dagger. Dagger is alright but mainly popular in the Android world where Koin is the main alternative. However, Koin is native to Kotlin and a kotlin multiplatform project. So you can use it on Android, server development, IOS native, kotlin-js, etc.

Nice, I haven't seen this one. We've been using Dagger to get people off of runtime DI for migrating to serverless, but I'll take a look. I assume it's compile-time DI?

It's not, it's a runtime service locator. In my experience it doesn't scale terribly well.

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

#77
post #67

Earlier quoted context omitted.

Admittedly it's been awhile since I've written Java, so most of this is what I remember and what I've seen successful teams using -- got any links to a "true async" in Java? I was under the impression that all Java async work was backed by thread pools.

Yes, anything that uses NIO / Netty / epoll / io_uring / etc. under the covers will do. There are several options--IIRC at least five choices are available, but these are the ones that come to mind: https://openjdk.java.net/jeps/321 https://github.com/AsyncHttpClient/async-http-client https://hc.apache.org/httpcomponents-client-5.1.x/examples-a...

Thanks! I did a little research and it seems like there are some Kotlin coroutine to nio mappings (it looked like some were experimental though) and that OkHTTP is aiming to use coroutines, so I wonder if these will converge in the future.

What wasn't clear to me was if the coroutine/nio mashup still used threadpools because coroutines do.

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

#78
post #33

Earlier quoted context omitted.

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 Int…

Netbeans was really great, maybe still is, but the noise jetbrains made with the astroturfing advertizing has jetbrains dominating everything. IMHO Netbeans was ahead of idea in many ways. But since they didn't buy commenteers to hype their product it's pretty much nowhere, at least I don't know anyone who uses it.

I'm someone who has regularly recommends Jetbrains software (including IntelliJ and Resharper) to others in comments, and now I'm wondering if they forgot to send me my check.

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

#79
I'll chime in my opinion: Java is getting something right that I don't see much elsewhere: Dependency Injection. Combine this with a mocking framework and you can write _actual_ isolated unit tests for every single part of your stack.

We're fans of CDI, it's a more polished Spring framework without the legacy weight. We're developing in Quarkus, MicroProfile, and bigger monoliths in Apache TomEE. We use ActiveMQ extensively for scaling. ( And I mean extensively... on a modest 512m server, we can push several thousand messages/s reliably to a _lot_ of topics and queues, all with delivered-exactly-once guarantees)

We avoid the fanfare of Docker, as really it's not needed for Java apps; they're somewhat self-contained anyway and it created more problems than it solved. For true isolation, we use systemd to create cgroups and chroots and prevent application escapes. For deployment, apps are one-jar'd down to a single executable, then packaged up in a .deb using the jdeb maven plugin. We stick with the unix philosohpy of using /etc/default for env variables that help the app locate their database or LDAP cluster.

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

#80
post #43

Over the last five years, the Java Platform has seen a tremendous amount of evolution and improvement in a variety of areas, including: language features in Java, Kotlin, and Scala; Functional Programming; dev environments; test workflows; Reactive; Stream processing; and distributed data.

Is Scala still in trend?

It's Kotlin now. Kotlin has similar expressibility and extensibility, without Scala pitfalls. (Scala pitfalls that people didn't like included new versions having breaking changes, complexity, theoretical/academic features that weren't necessarily useful to consumer applications, and slow build times).
Post reply on HN