News for hackers. Stuff that matters.
Re:The Modern Java Platform – 2021 Edition by selfhoster11 on Wednesday March 17, 2021 @09:34AM (#26490979)
You know what should be taking care of all of these things? Java! For a language that bills itself as the "enterprise language #1", it's abysmal in supporting actual enterprise features like you listed above in a lightweight fashion. Instead, a whole third-party framework has to be tacked on just so you don't have to reinvent the wheel. Java doesn't even support dependency injection, something that I would consider an absolute minimum for even a small project.
Re:The Modern Java Platform – 2021 Edition by dmux on Wednesday March 17, 2021 @10:01AM (#26491356)
>Java doesn't even support dependency injection, something that I would consider an absolute minimum for even a small project.

For small projects, DI is easy done by passing things via the constructor. If multiple things need to get wired together, pull that wiring logic out into its own class or method (FooBuilder.buildDefault()). If things start to get tedious, that's a really good time to stop and reflect on the design choices. That stop-and-reflect opportunity if often lost when things can be simply AutoWired together.

Re:The Modern Java Platform – 2021 Edition by jacques_chester on Wednesday March 17, 2021 @11:27AM (#26492550)
Jakarta (née Java EE) has CDI, which bears a striking similarity to the Spring's dependency injection capability: http://cdi-spec.org/
Re:The Modern Java Platform – 2021 Edition by diroussel on Thursday March 18, 2021 @06:25PM (#26508179)
The real thing that is missing is a runtime annotation scanning API.

Spring does this my examining the class path, casting it to a urlclasspath, finding all the zip/jar files, unzipping them and then parsing the byte code.

Interestingly the set let spec added annotation scanning too. And now if your not careful you jar files get extracted three times. The JVM, the server conteainer and spring all repeating the same work.

No wonder people think java is slow to start up.

Re:The Modern Java Platform – 2021 Edition by cryptos on Wednesday March 17, 2021 @09:09PM (#26498749)
I don't think there is a need to blur the line between a standard library and frameworks. Maybe @Inject should have been in the JDK, but on the other hand it can be added to any project easily and is supported by several frameworks.

In general I think, it is wise to keep the standard library small, because innovations are easier to implement in libraries. Rust is a good example for this style.

Re:The Modern Java Platform – 2021 Edition by lmm on Wednesday March 17, 2021 @10:08PM (#26499072)
If Java had had first-class functions to start with, things like Spring would probably have never got off the ground. Up until Java 8 you couldn't even pass a reference to a constructor as an argument without defining a whole class to carry it around in.
Re:The Modern Java Platform – 2021 Edition by cryptos on Thursday March 18, 2021 @02:51AM (#26500218)
But first-class function is a completely different thing than dependency injection (DI). Supporting functional programming is a an aspect of the programming language itself, while DI is part of the infrastructure.

I agree with you, that Java should have had first-class function from day one. Ironically this was considered by the language designers, but they decided that it would be too exotic for the average Joe. OOP was a hype back then ...

Re:The Modern Java Platform – 2021 Edition by lmm on Thursday March 18, 2021 @04:57AM (#26500743)
DI is a design technique, you don't have to use a framework to implement it. Reflection-based frameworks became a popular way of doing it in Java because doing it in plain Java is cumbersome, and that's due to the limitations of Java as a language.