Friday, February 25, 2011

Cost associated with reflections in java

Reflection is v.powerful and useful, but comes at some cost:
  • You lose all the benefits of compile-time type checking, including exception checking. If a program attempts to invoke a nonexistent or inaccessible method reflectively, it will fail at run time unless you've taken special precautions.
  • The code required to perform reflective access is clumsy and verbose. It is tedious to write and difficult to read.
  • Performance suffers

No comments:

Post a Comment

Chitika