ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Use of reflection in DirectoryScanner to remove duplicated code
Date Thu, 24 Aug 2006 17:04:59 GMT
--- Antoine Levy-Lambert <antoine@gmx.de> wrote:

> 
> On Aug 23, 2006, at 7:26 AM, Kev Jackson wrote:
> 
> > Hi,
> >
> > I want to run this by people here to see what
> people think of  
> > this.  Basically DirectoryScanner has some
> duplicated code  
> > [ accountForIncludedFile, accountForIncludedDir ],
> I think I have a  
> > refactored processIncluded method that can replace
> the duplication,  
> > but it relies on using Reflection to get access to
> the classes  
> > fields and then does the work [1].  I know a lot
> of Java developers  
> > are a little leary about using reflection in
> general as it has a  
> > reputation for being slow and obtuse, so I'd like
> to see what you  
> > guys think before committing something that will
> be veto'd.
> >
> > Thanks,
> > Kev
> >
> > [1]
> Hi Kev,
> 
> I know that code duplication is not nice, but I am
> +0 on this because  
> using reflection makes code analysis tools not do
> their work  
> correctly. If you do for instance a method call
> graph in an IDE,  
> methods called by reflection will not be displayed.
> 
> I prefer code which is more lengthy but readable.
> 
> If we had a solution to remove this duplication by
> using classes/ 
> interfaces I would find it neater.

I am not historically a champion of readability for
its own sake ;) , but in this case I am of the general
impression (without having thoroughly perused the
proposed change) that it should be possible to
eliminate the duplication without resorting to
reflection.  To rephrase, if reflection were (is) the
only way to remove the duplication, I would be +1.  I
am not sure it has been demonstrated that this is the
case, so pending clarification here I would categorize
my stance as -0.

-Matt

> 
> Just my 2 cents.
> 
> Antoine
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message