ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: Ant2 suggestions
Date Tue, 17 Jul 2001 08:00:46 GMT
On Tue, 17 Jul 2001 17:24, Kurt Huwig wrote:
> Then you must have been better than me ;-) I do also have projects with
> only one Makefile, but this makes concurrent development a pain in the ass,
> as every developer needs to modify the makefile when adding files to the
> project. With Ant, you just rebuild a directory which is much easier.

Thats also possible with GNUMake aswell ;) It is just that only a few people 
handwrite build files and thus you end up with monstrous generated 
makefiles.

> That's correct. But you can use the same code for all tasks, so that you
> don't need these 'createFileset'-methods replicated in each task. But you
> can handle this very easy by using task-specific properties that tell Ant
> the name of the parameters for these, maybe like this
>
>   public class MyTask extends Task {
>     public MyTask() {
>       setInFileName( "source" );
>       setOutFileName( "target" );
>     }
>   }

Something similar to that will be possible in Ant2. However it will probably 
be implemented slightly differently.
> > > Code like
> > >
> > >   fs.getDirectoryScanner( project )
> > >
> > > where 'project' is inherited from a super class is not very object
> >
> > oriented.
> > What exactly is not 'object oriented' about this construct? The fact that
> > a task inherits its project or that the fileset needs the project to
> > setup the scanner?
>
> Inheritance of fields is a Bad Thing (tm) IMHO. 

agreed.

> You can also use the Singleton-pattern to remove the need to refer
> by a field. Hotspot optimizes getter and setter-methods, so you don't even
> have a speed advance if you access the fields directly.

Singleton is one solution but we will be moving away from it. We will provide 
a TaskContext through which you can access resources and probably have an 
AbstractTask that simplifies this by caching TaskContext and having easier 
accessors. Similar to the way Servlet and GenericServlet+HttpServlet work.

> Just imagine having the need to switch to several projects for whatever
> reason. Then you have to change every line of code that refers to
> 'project'. If you use 'getProject()' instead, you just have to change the
> code of this method and that's it. I had the problem of changing a software
> from single document to multi document interface and was glad for using
> access methods.

Alternatively you could just design the software so that it doesn't need and 
can never get access to project. Makes it much easier to have multi-project, 
no project (ie for script writing) or anyother combination ;) I am fairly 
certain thats the strategy we will end up using.

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