Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
oh, you're doing reflection now! Good luck!
It's quite easy though. Wait till you get to the Mirror API! -
If you're using reflection at anything other than the framework level, I'd argue it's most likely a case of bad design.
Reflection isn't hard in and of itself, but it can make code rather hard to reason about (and potentially renders a lot of IDE warnings about unused code etc. useless.) -
@AlmondSauce And slow :) Unless cached properly, reflection lookups are not something one should be making in each request.
-
Maer16885yUsage of reflection nowadays is pretty limited to some very specific cases, often involving DI or specific 3rd party libraries. One of the main reasons it is discouraged is because it often bypasses the OOP design which is the strong suit of Java in the first place.
As mentiined above I'd refrain from using it unless unavoidable and many problems that are haphazardly solved via reflection should instead be solved with better design.
Related Rants
Don't remember who but someone here told me once, when I mentioned that I do java now, "wait till you get to reflection..."
Well it's time to suffer
rant
suffer
reflection
java