[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-dev
Subject:    Re: Ant q? about core Java task: why are members private?
From:       "Steve Loughran" <steve_l () iseran ! com>
Date:       2001-03-29 21:59:03
[Download RAW message or body]


----- Original Message -----
From: "Tim Vernum" <Tim.Vernum@macquarie.com.au>
To: <ant-dev@jakarta.apache.org>
Sent: Wednesday, March 28, 2001 16:04
Subject: RE: Ant q? about core Java task: why are members private?


> From: Steve Loughran [mailto:steve_l@iseran.com]
>
> > ----- Original Message -----
> > From: "Peter Donald" <donaldp@apache.org>
> > To: <ant-dev@jakarta.apache.org>
> > Cc: <ant-dev@jakarta.apache.org>
> > Sent: Tuesday, March 27, 2001 4:06 PM
> > Subject: Re: Ant q? about core Java task: why are members private?
> >
> >
> > > At 06:53  27/3/01 -0500, Eric Siegerman wrote:
> > > >On Wed, Mar 28, 2001 at 09:43:05AM +1000, Peter Donald wrote:
>
> > > >> I would prefer to keep everything as protected (unless
> > > >> we provide accessors to them)
> > > >
> > > >Why *not* provide accessors?
> > >
> > > That would be excessive work ;) Though if someone else was
> > to do it ...
> >
> > +1 on 'recommend that all new tasks to provide accessors to
> > their (private)
> > member variables'. Making things accessible to subclasses effectively
> > freezes the base implementation.
>
> Exposing things through accessors is not necessarily any better.
> Just because a class has a private variable, that does not mean that
> it should provide any means of access to them.
>
> Doing so, will increase the contract between the core task, and
> other tasks, in ways that might not be appropriate.

true.

but if read access has to be granted to subclasses, providing an accessor
method is preferable to going replacinng private with protected through the
file.

So really the guideline should be something 'dont make content accessible
unless you are prepared to maintain that interface forever, -and if you are
prepared to do so, the best way is through accessor methods'

seem reasonable ?

-steve

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic