ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Rees <d.ree...@usa.net>
Subject Re: [DISC] core extensions
Date Tue, 27 Mar 2001 21:29:55 GMT
On Wed, 28 Mar 2001 08:18:22 +1200, Michael McCallum wrote:

>
>> >>> * define task contexts that define various common aspects
>> >>> * (logging, failure handling ...) and assign them to tasks.
>> >>
>> >>Need more input - on the "and assign" part.
>> > 
>> > I was thinking something as simple as the following for logging.
>> > 
>> > interface Task
>> > {
>> >  void setTaskContext( TaskContext context );
>> > {
>> > 
>> > class MyTask
>> > {
>> >   TaskContext context;
>> > 
>> >   void setTaskContext( TaskContext context )
>> >   {
>> >     this.context = context;
>> >   }
>> > 
>> >   Logger getLogger()
>> >   {
>> >     return context.getLogger();
>> >   }
>> 
>> [...]
>> 
>> wouldn't setTaskContext and getLogger better by part of an abstract
>> Task (and why should Task be an interface)? But we are getting into
>> details here.
>IMO no. 
>

Ai gree, the various methods that are called on Task should take a
context object to provide logging etc.


>>why should Task be an interface?
>Basically it is not necessary for task to be an abstract/conrete class. Because it can
be 
>implemented as an interface. Some situations require that a you use an abstract class
or 
>concrete class so if other things you wish to extend/implement are all interfaces it is
cleaner 
>otherwise you end up using adapters everywhere and it gets ugly.
>

As a complete aside, I really think Java should support "implements
Class".

d

Mime
View raw message