4 ms·
> There are a lot of things like that you can do in Java which people just don't do that makes many things a lot cleaner. The problem is not "people could use
by dirkt 6y ago
> There are a lot of things like that you can do in Java which people just don't do that makes many things a lot cleaner.
The problem is not "people could use that particular Java feature to make code cleaner, but they don't".
The problem is on a higher-level: If you have ever tried to read your way through some library, e.g. Spring, you'll see code spread over hundreds of files, and it takes ages to just find out where that particular bit of code you need is, because it's automatically injected in some builder class which is an inner object extending some other object that implements an interface somewhere.
And then you have several competing abstractions, and sometimes one gets used, and sometimes the other.
IDEs and type hierarchies help, but only to some degree.
And then you are still stuck with an overengineered abstraction that nevertheless does not allow you to do the obvious thing that needs to be done in your particular case. So you need to implement a fragile workaround, for example copying one of the library classes, modifying it a bit, and then injecting it instead of the one from the framework. All of which will horribly break if someone changes something in the library.
"Style" is never the problem.
- username90 6y ago> The problem is on a higher-level: If you have ever tried to read your way through some library, e.g. Spring, you'll see code spread over hundreds of files, and it takes ages to just find out where that particular bit of code you need is, because it's automatically injected in some builder class which is an inner object extending some other object that implements an interface somewhere. There is nothing about Java the language which forces code to be written this way though.