Live data from Hacker News

Jodd – The Unbearable Lightness of Java

jodd.org

11–20 of 239 posts

Re: Jodd – The Unbearable Lightness of Java

#11

I haven't really touched Java in a while but I don't get why you'd want a lightweight DI container . You can just build your object graph and pass dependencies manually if you want a lightweight approach, no? That's just the way people do it in most languages.

here is the talk, good stuff, Dead-Simple Dependency Injection

https://www.youtube.com/watch?v=ZasXwtTRkio

Re: Jodd – The Unbearable Lightness of Java

#12
post #5

I wonder if someone can recommend a lightweight http server library? I like Javalin but it's based on Jetty which is a fully JavaEE compliant framework and includes support for things like OSGI which I don't need. With the whole Log4j situation, I'm re-evaluating some the libraries I've previously relied on.

https://github.com/tinspin/rupy

Re: Jodd – The Unbearable Lightness of Java

#14
post #5

I wonder if someone can recommend a lightweight http server library? I like Javalin but it's based on Jetty which is a fully JavaEE compliant framework and includes support for things like OSGI which I don't need. With the whole Log4j situation, I'm re-evaluating some the libraries I've previously relied on.

Vert.x

It's built on top of Netty but has some additional niceties that make it more practical to use. It's also one of the fastest things out there: https://www.techempower.com/benchmarks/#section=data-r18&hw=...

Re: Jodd – The Unbearable Lightness of Java

#15

I haven't really touched Java in a while but I don't get why you'd want a lightweight DI container . You can just build your object graph and pass dependencies manually if you want a lightweight approach, no? That's just the way people do it in most languages.

I think there are a lot of Java developers, that have just never worked without a DI framework, and just don't have a grasp on just how simple it can be to write code without one.

Re: Jodd – The Unbearable Lightness of Java

#16
post #10
post #7

Earlier quoted context omitted.

We looked around since we wanted to move off Tomcat and decided on Netty: https://netty.io/ I'm not on the engineering team so can't speak to the cost/benefit, but it seems to have been a pretty successful transition.

EDIT - it seems maybe I was wrong here Netty copies the response body when sending to each client, so it's not as lightweight as I've found. For streaming large response bodies, it does not work well. I haven't found a good Java alternative yet (probably will switch to C++ and uWS...)

Netty core is about as close to the metal as networking gets on the JVM. It's abstractions are built over a zero-copy capable byte buffer, and there is generally a lot of care taken to avoid copying where possible. I haven't used the websocket codec, but I'm sure the maintainers would welcome a patch that removes unnecessary copying.

Re: Jodd – The Unbearable Lightness of Java

#17
post #5

I wonder if someone can recommend a lightweight http server library? I like Javalin but it's based on Jetty which is a fully JavaEE compliant framework and includes support for things like OSGI which I don't need. With the whole Log4j situation, I'm re-evaluating some the libraries I've previously relied on.

If you have Java 11+ I presume you can't get any simpler than a standard library module:

https://docs.oracle.com/en/java/javase/17/docs/api/jdk.https...

Re: Jodd – The Unbearable Lightness of Java

#18

I haven't really touched Java in a while but I don't get why you'd want a lightweight DI container . You can just build your object graph and pass dependencies manually if you want a lightweight approach, no? That's just the way people do it in most languages.

Sure, and eventually you end up rebuilding an [ad hoc, informally-specified, bug-ridden, slow] DI container because:

* Static references become a tangled mess, and you start wanting some structure around that.

* You have to answer "how does ABC component get access to DEF?" for increasingly difficult combinations of ABC and DEF.

Excepting Spring, pretty much all Java DI containers are lightweight.

Re: Jodd – The Unbearable Lightness of Java

#19
I really like the Go-like simplicity of these libraries, without the cursed architecture astronomy from the 2000s.

In general it's interesting times for Java. With all of language improvements from Kotlin/Scala, and upcoming Go-like concurrency it really feels like a renaissance for the language.

Re: Jodd – The Unbearable Lightness of Java

#20

I haven't really touched Java in a while but I don't get why you'd want a lightweight DI container . You can just build your object graph and pass dependencies manually if you want a lightweight approach, no? That's just the way people do it in most languages.

Sure, and eventually you end up rebuilding an [ad hoc, informally-specified, bug-ridden, slow] DI container because: * Static references become a tangled mess, and you start wanting some structure around that. * You have to answer "how does ABC component get access to DEF?" for increasingly difficult combinations of ABC and DEF. Excepting Spring, pretty much all Java DI containers are lightweight.

This, it’s really exhausting to read this never ending wheel reinvention. Sure any one can use simpler non-spring frameworks, and other “non standard” frameworks and libraries for 1/10 or 1/100 of the functionality, and get 10-100x the bugs and much less or zero support. But we need netty! And then when you add thread pools, jdbc, logging, etc? Yep you’ve reimplemented spring. Just use spring, spend the time to learn it and reap the rewards.
Post reply on HN