[jdom-interest] Query regarding the Parent/Child interfaces.

Elliotte Harold - java FAQ elharo at metalab.unc.edu
Fri Mar 19 09:53:23 PST 2004


On Wed, 17 Mar 2004, Simon Gauld wrote:

> Alex: I find it interesting that you believe using instanceof should be
> avoided or minimized - this is a technique I find quite useful to be able to
> derive general functionality - I wasn't aware it was something that that
> should be avoided, and am somewhat confused as to why you say minimize uses
> of it.
> 

In my experience instanceof is a perfomance sink. Any common method that 
calls it is almost certainly a hot spot. I go to great lengths to aovid 
it. (Also frequent use of instanceof generally indicates a poorly designed 
set of classes with insufficient use of polymorphism.)

--
Elliotte Rusty Harold     
elharo at metalab.unc.edu    
elharo at macfaq.com




More information about the jdom-interest mailing list