"Geir Magnusson Jr." <[EMAIL PROTECTED]> writes:
> Daniel Rall wrote:
> >
> > "Geir Magnusson Jr." <[EMAIL PROTECTED]> writes:
> >
> > > Eric Dobbs wrote:
> > > >
> > > > On Wednesday, June 20, 2001, at 09:21 PM, Geir Magnusson Jr. wrote:
> > > >
> > > > > Daniel Rall wrote:
> > > > >>
> > > > >> Boiled down from a discussion w/ jvz on IRC:
> > > > >>
> > > > >> Classes implementing a given piece of functionality that don't
> > > > >> absolutely need to be public (such as those which are only used
> > > > >> internally by that functionality), should provide only a package or
> > > > >> derivitative-accessible API (default or protected access for both
> > > > >> class and methods).
> > > > >>
> > > > >
> > > > > Doesn't this mean that if the said class isn't declared public, you
> > > > > force the derived class to be placed in the package?
> > > >
> > > > If I understand correctly, a protected method can be used by any
> > > > subclass, regardless of the package. Whereas the default access
> > > > means that only subclasses in the same package can use those
> > > > methods.
> > > >
> > >
> > > That's right. But above, it says default or protected access for both
> > > *class* and methods - implying the subclass is of the same package?
> >
> > Classes cannot be protected, so default access only applies to class
> > themselves. Protected access should be preferred to default for
> > methods, since protected methods are also available to other classes
> > in the same package (not just to subclasses, as is often assumed).
> >
> > Does this clarify things?
>
> The point I am focusing on is that the classes should be public if you
> want people to extend them and *not* have to put their code in the same
> package. Isn't that right?
Correct. My thinking is that they should only be package-private
(i.e. default access) if they are part of the internal workings of the
service or its gears. We can always open them up later if people find
that they are actually needed.
However, are you suggesting that if all the methods in these classes
are protected, that the classes should just be public any way?
Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]