ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject RE: Ant q? about core Java task: why are members private?
Date Tue, 27 Mar 2001 23:43:05 GMT
At 09:38  28/3/01 +1000, Conor MacNeill wrote:
>A couple of points.
>
>I am generally against having data members as protected. It means weaker
>encapsulation, which allows subclasses to violate the super class' call
>invariant. It also increases the size of the contract between the class and
>any subclasses. That contract should be restricted to methods, IMHO.
>
>I am also concerned about creating a larger contract from Ant's core to task
>developers. To make backward compatability easier, we should have a fairly
>narrow contract to task writers. Rather than extending core Tasks or even
>using project.createTask to have an embedded task, we should be providing
>the services in the Ant core that are available to Task writers to perform
>certain common operations.
>
>For example to execute java code, Ant currently provides the ExecuteJava
>class.
>
>Thoughts?

In general I agree 100% ;) However in some cases sub-classing is desirable
(zip/war/ear tasks). I would prefer to keep everything as protected (unless
we provide accessors to them) and just place big warning signs. 

ie ANT developers make NO guarentee about internal implementation of future
classes and relying on this is very very very likely to cause your task to
break. 

If not entirely true - it does get the point across ;)

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message