ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@gmx.de>
Subject Re: Use of reflection in DirectoryScanner to remove duplicated code
Date Wed, 23 Aug 2006 12:43:24 GMT

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.

Just my 2 cents.

Antoine

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


Mime
View raw message