ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: [Bug 7482] - PatternSet.setIncludes() does not SET includes, but appends them to a list
Date Wed, 27 Mar 2002 10:48:23 GMT
On Wednesday 27 March 2002 09:25 am, Darrell DeBoer wrote:
> When functionality needs to be shared between tasks, it's
> much better to refactor that functionality out into a separate,
> well-defined helper class to be used by both Tasks.

As in the example of MatchingTask ;)

> A few other notes that I agree with you on. (or I'm just sprouting
> off ;) )
> * I tend to always favour delegation over inheritance
> * Where I use inheritance, I prefer to pull common functionality into a
> common, abstract superclass, so that concrete classes aren't themselves
> extended. (abstract or final, you choose...)

As in the case of Jar (extends Zip, which extends MatchingTask) ;)

> * I tend to use interfaces everywhere that I need polymorphism.

As in the case of Task. ;)

> This approach leads to a greater number of simpler classes, and I believe
> produces more maintainable, more extensible code. I'm guessing that many
> people disagree with this approach (I'm often distressed by the lack of
> interfaces in the Java APIs themselves), but it works for me.

i don't disagree at all, but i will point out that while we're preaching 
this, the Ant tree, in many places, does not look like this!

i know several people here complain about subclassing, and my own experience 
is that most of this problem comes from accessing data members without using 
getters. Even *internally* i use getters to get at all data. Sure, it's an 
extra function call, but it's a small price to pay for the comfort i feel 
knowing that my objects are never mucked around with aside from the API. i 
also find that doing so helps you design a better API: by using your own API 
within your own object you inherently design a more reusable class.

----- stephan
Generic Unix Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"...control is a degree of inhibition, and a system which is perfectly
inhibited is completely frozen." -- Alan W. Watts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message