Earlier quoted context omitted.
Containerization is great. It allows you to write all the infrastructure for you Java app as code and then just simply type 'docker-compose up' to get it running (or whatever your orchestrator). This makes it super portable. Just something to think about. I personally think the win's from Containerization are greater than the challenges.
You don't necessarily need containers for that though?
Ask HN: What is a modern Java environment?
131–140 of 153 posts
Re: Ask HN: What is a modern Java environment?
#132Earlier quoted context omitted.
> 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. What does this mean?
Because the code runs in a VM already, they are not concerned about isolating further. For example, if you're writing code in C++ targeting Linux, using Docker helps with reproducible builds and deploying on any hardware. But if you have a VM, there are less advantages. There still are some, of course, with orchestration etc if you want it.
Re: Ask HN: What is a modern Java environment?
#133Earlier quoted context omitted.
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?
#134Personally, after the log4j fiasco, I wouldn't touch Java. The standard ecosystem setup is to use all the major 3p libraries for all your functionality (Jaxrs, swagger, log4j, jersey, e.t.c) While this generally works, the ecosystem is full of holes (like log4j), and crappy behavior. You get things like "javax.ws.rs.ProcessingException: Already connected", exceptions which mask underlying issues like not being able t…
> Network latencies dominate the processing speed these days I want to see data on this. It gets repeated over and over but this doesn't match my experience at all. Am I crazy?
Re: Ask HN: What is a modern Java environment?
#135I'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 exte…
I've been a developer over a decade, never touched the JVM because I always figured it was bloated Enterprise garbage. I did a project using GraalVM's polyglot abilities and needed an API. Tried Spring, Micronaut, Helidon, Ktor and Quarkus. Quarkus is the best web framework I've ever used, in any language. Can't go back now. It's so well-architected that I was able to contribute an extension for Scala 3 support withi…
Re: Ask HN: What is a modern Java environment?
#136Earlier 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?
You can inject a property by defining it as a koin injected property:
class SomeClass {
val foo by koinContext.inject()
}
And this is how you could create your koin context: class Bar()
class Foo(bar: Bar)
val myModule = module {
single { Bar() }
// get() knows the type from the argument position at compile time
// and it looks the object from the context by type
single { Foo(get()) }
}
// trigger this in your main or at application startup
startKoin {
modules(myModule)
}
// if you want to use inject, you can use a global variable for getting at the context
val koinContext by lazy { GlobalContext.get() }
Modules can be tied to life cycles on Android and there are a few more features like being clever about co-routine scopes. But there's not a lot more to it in terms to using it. Very simple code to write. Low overhead. It's all just function calls.Spring has a similar kotlin bean dsl that was added a while ago that you can use as an alternative to annotation processing (which is much slower).
Re: Ask HN: What is a modern Java environment?
#137Earlier quoted context omitted.
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 really wouldn’t go the async way unless it was deemed absolutely necessary for maximal performance — it makes reasoning/debugging much harder with often not much gain. Also, if one can just wait a few years, loom will make many part of it obsolete - when blocking code will magically get non-blocking while it retains the readibility.
Loom won't make any of this obsolete. If anything, co-routines will probably be the most user friendly API to use Loom when it comes available. Loom is a pretty low level API and you probably should not use it directly and instead use something that uses that. Like Kotlin co-routines, which is designed as a high level API that can be backed by all sorts of asynchronous and parallel computing implementations/
Extension functions exist for webflux, rx-java, vert.x, thread pools and much more. Basically, it sits on top of these things. It also works on kotlin native, kotlin-js (in a browser and node-js) and in the JVM where the underlying platform of course provides very different implementations. For the end user, it works pretty much in the same way across these platforms.
Loom will just be another low level backend for the co-routine API. It will likely give you some performance benefits if it's available and that's about it. Update the co-routine library, maybe fiddle a bit with your co-routine scope's and you'll be using Loom. I'd expect very little code changes would be needed when the time comes. Perhaps none at all actually (aside from bumping a version number).
Re: Ask HN: What is a modern Java environment?
#138Earlier quoted context omitted.
> Network latencies dominate the processing speed these days I want to see data on this. It gets repeated over and over but this doesn't match my experience at all. Am I crazy?
It takes me about 250ms to load hackernews as seen on the browser debug network tab. The total compute for that request is minimal. Speeding this up may reduce total infrastructure costs, where if everything is kept static you will see benefits long term, but in terms of reducing total latency, it will be next to irrelevant.
By "incredibly slow" I mean comparing what it does versus how fast it could be on an average machine.
Network and other I/O latency is often used as an excuse and sweeping generalization. It's never that easy. You need to actually look at a running process and gather data about it before you can make claims about what the bottlenecks are. Also even if there are constant factors that you cannot optimize it doesn't absolve a program from being slow in every other aspect, secondly there are techniques to mitigate and isolate latency bottlenecks.
Re: Ask HN: What is a modern Java environment?
#139Earlier quoted context omitted.
I've been a developer over a decade, never touched the JVM because I always figured it was bloated Enterprise garbage. I did a project using GraalVM's polyglot abilities and needed an API. Tried Spring, Micronaut, Helidon, Ktor and Quarkus. Quarkus is the best web framework I've ever used, in any language. Can't go back now. It's so well-architected that I was able to contribute an extension for Scala 3 support withi…
Just had a look at your scala 3 extension, it's really nice. Does it support hot code reload like you would get in quarkus dev mode with java?
Admittedly the install instructions for Gradle are a bit dated. Gradle 7.4 shipped with Scala 3 support.
Re: Ask HN: What is a modern Java environment?
#140Earlier quoted context omitted.
Unfortunately not. Records are not compatible with JPA, so classic beans with getters and setters would still be a choice for many people. Record-friendly ORMs do not exist yet (I’m currently working on one).
Could you please share your ORM? I would really like to use java with much less reflection.