aspose file tools*
The moose likes Performance and the fly likes question about using reflection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "question about using reflection" Watch "question about using reflection" New topic
Author

question about using reflection

sudip narayan
Greenhorn

Joined: Apr 18, 2004
Posts: 15
Hi,
Is it a good practice to use reflection extensively. Are there any potential issues/pitfalls in using Reflection. Has it got better in newer versions of jdk 1.5 or 1.6 compared to older versions of jdk.

regards
sudip
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
I wouldn't use reflection just because its the cool thing to do, but you certainly see it alot in current projects to increase flexibility and convenience.

Bill

Java Resources at www.wbrogden.com
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29244
    
139

sudip narayan wrote:Hi,
Is it a good practice to use reflection extensively. Are there any potential issues/pitfalls in using Reflection.

Readability. It should be used when you need to do something very generic - like in a utility. It's rarely extensive - more isolated to a specific layer of your application.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4637
    
    5

sudip narayan wrote: Is it a good practice to use reflection extensively.


You are asking about reflection in a performance section? I see reflection as a very powerful tool, or a tool to build tools. But if you are using it a lot in production code, for me, that raises questions about your engineering tradeoffs.

With modern JIT optimizers, its probably not terrible for performance, but reflection code tends to be tricky to write and tricky to read.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about using reflection
 
Similar Threads
Xpath JDK 1.4
Jasper Report Error
Ant build error
How to locate a class without knowing its package
MessageDigest with SHA 256 algorithm fails