Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
netikras2298326doh, you're doing reflection now! Good luck!
It's quite easy though. Wait till you get to the Mirror API!
ltlian151126dThe best tip i got when running into reflection for the first time was "don't"
AlmondSauce859626dIf 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.)
Maer100426dUsage 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.