6 ms·
> 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 wha
by michaelt 6y ago
> 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.
- The_Colonel 6y ago> 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.
- valenterry 6y ago> 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.
- apta 6y ago> There are languages that doing better in this regards. Such as?
- valenterry 6y agoAs 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.
- apta 6y agoWhat about languages not on the JVM platform?
- valenterry 6y agoYes there are also such languages which are not on the JVM platform!
- apta 6y agoI'm curious what they are in your view.
- selfhoster11 6y agoThe 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.
- pron 6y ago> 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.