News for hackers. Stuff that matters.
Re:A Picture of Java in 2020 by michaelt on Tuesday September 22, 2020 @04:40AM (#24552278)
> I assume you mean reflection - this would be very untypical for normal business logic code

No, a lot of java critics complain about it being hard to tell what's calling what at the framework-to-user-code boundary

That means not only reflection, but also most Dependency Injection (Spring autowiring, Guice...), anything that runs on annotations (including @Test and JAX-RS), any code auto-generation (e.g. Protobufs, Jooq), most mock libraries (e.g. Mockito) and most configurable logging, especially the logging libraries that try to auto-detect one another.

Of course, some would say those problem are with Corporate Java Culture choosing to use all those things, rather than the Java language itself.

Re:A Picture of Java in 2020 by selfhoster11 on Tuesday September 22, 2020 @06:21AM (#24552831)
The loosely coupled metaprogramming of frameworks like Spring is an indication of how feature-poor Java is in those areas. Autowiring and mocking should be first-class features with dedicated syntactic elements, rather than something that's handled by third parties with opaque annotations that mean nothing before the application is run.

I understand that Java wants to remain conservative with its development roadmap, but the fact that the majority of an ecosystem uses a third-party framework is a good reason incorporate something similar into the language.

Re:A Picture of Java in 2020 by The_Colonel on Tuesday September 22, 2020 @04:58AM (#24552379)
> No, a lot of java critics complain about it being hard to tell what's calling what at the framework-to-user-code boundary

That's rather an industry criticism since these problems exist everywhere and are often direct consequence of trade off for looser coupling.

There are also often alternatives - e.g. Dagger for DI and MapStruct for mapping which go the code generation path which allow you to statically inspect the whole code path, you can also always trade the looser coupling for more directed paths e.g. for logging by avoiding the wrapper and using a logging library directly.

Re:A Picture of Java in 2020 by valenterry on Tuesday September 22, 2020 @12:39PM (#24556652)
> That's rather an industry criticism since these problems exist everywhere and are often direct consequence of trade off for looser coupling.

No they don't. Java is just not expressive enough, so library/framework authors have to decide between bloat or magic and they often choose magic for better or worse. There are languages that doing better in this regards.

Re:A Picture of Java in 2020 by apta on Tuesday September 22, 2020 @09:58PM (#24562173)
> There are languages that doing better in this regards.

Such as?

Re:A Picture of Java in 2020 by valenterry on Tuesday September 22, 2020 @10:49PM (#24562443)
As we are talking about Java, the closest language would be Scala. The language is much more flexible and powerful. This brings different problems onto the table, but it resolves the issue with awkward framework annotation/wiring problems that I have experienced in Java way to often.
Re:A Picture of Java in 2020 by apta on Wednesday September 23, 2020 @03:55PM (#24571206)
What about languages not on the JVM platform?
Re:A Picture of Java in 2020 by valenterry on Wednesday September 23, 2020 @09:02PM (#24574236)
Yes there are also such languages which are not on the JVM platform!
Re:A Picture of Java in 2020 by apta on Friday September 25, 2020 @04:36PM (#24593844)
I'm curious what they are in your view.
Re:A Picture of Java in 2020 by pron on Tuesday September 22, 2020 @07:47AM (#24553370)
> Of course, some would say those problem are with Corporate Java Culture choosing to use all those things, rather than the Java language itself.

I'm not sure this is necessarily a culture, either. Java tends to be picked more for applications with more demanding/richer requirements, and so they need to do a lot. This demand for features drives a demand for richer frameworks. You see this exact thing happening with JS on the client. So to the extent this is a problem, perhaps it is a general software design problem.