You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2013/03/18 10:54:14 UTC

[FILEUPLOAD] Package protected classes have public methods - make these package protected?

The new utils.mime classes for MIME decoding are mostly package-protected.

However, they have public methods (and ctors) which is a bit misleading.

I think it would make sense to reduce the visibility to package protected.

Any objections?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by Benedikt Ritter <br...@apache.org>.
2013/3/18 sebb <se...@gmail.com>

> On 18 March 2013 10:07, Benedikt Ritter <br...@apache.org> wrote:
> > 2013/3/18 sebb <se...@gmail.com>
> >
> >> The new utils.mime classes for MIME decoding are mostly
> package-protected.
> >>
> >> However, they have public methods (and ctors) which is a bit misleading.
> >>
> >> I think it would make sense to reduce the visibility to package
> protected.
> >>
> >> Any objections?
> >>
> >
> > I personally don't align visibility of methods to the defining classes
> > visibility. If you decide to change the classes visibility to public you
> > will have to go though all methods and change method visibility too...
>
> Well yes, of course.
> But these classes are specifically for internal use only.
>
> Also I think objects should be created with the minimum visibility
> required.
> If it turns out more visibility is needed, it can be changed without
> causing incompatibility.
> Reducing visibility after release is not so easy.
>

In any case the person who changes visibility has to review to class
changed.
I'm indifferent in this case. If we decide to make methods (and ctors) of
package private classes also package private, we should document this at
http://wiki.apache.org/commons/CodeStyle so it doesn't get lost in the mail
archives.

Benedikt


>
> > Benedikt
> >
> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
> >
> >
> > --
> > http://people.apache.org/~britter/
> > http://www.systemoutprintln.de/
> > http://twitter.com/BenediktRitter
> > http://github.com/britter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by sebb <se...@gmail.com>.
On 19 March 2013 20:45, Oliver Heger <ol...@oliver-heger.de> wrote:
> Am 18.03.2013 11:19, schrieb sebb:
>
>> On 18 March 2013 10:07, Benedikt Ritter <br...@apache.org> wrote:
>>>
>>> 2013/3/18 sebb <se...@gmail.com>
>>>
>>>> The new utils.mime classes for MIME decoding are mostly
>>>> package-protected.
>>>>
>>>> However, they have public methods (and ctors) which is a bit misleading.
>>>>
>>>> I think it would make sense to reduce the visibility to package
>>>> protected.
>>>>
>>>> Any objections?
>>>>
>>>
>>> I personally don't align visibility of methods to the defining classes
>>> visibility. If you decide to change the classes visibility to public you
>>> will have to go though all methods and change method visibility too...
>>
>>
>> Well yes, of course.
>> But these classes are specifically for internal use only.
>>
>> Also I think objects should be created with the minimum visibility
>> required.
>> If it turns out more visibility is needed, it can be changed without
>> causing incompatibility.
>> Reducing visibility after release is not so easy.
>>
>
> Sorry, I disagree here. The classes affected are not part of the public API,
> so the argument of reducing visibility does not hold.

In which case, all the methods might as well be public in a
package-protected class.
If the class is later made public, that could cause problems if some
of the methods should not have been made public.

> OTOH, different visibility of methods is a hint which methods are expected
> to be called from outside and which are internal helper methods.

Indeed, which is why the helper methods should be private or package
protected as appropriate.

> Oliver
>
>
>
>>> Benedikt
>>>
>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>>
>>>
>>>
>>> --
>>> http://people.apache.org/~britter/
>>> http://www.systemoutprintln.de/
>>> http://twitter.com/BenediktRitter
>>> http://github.com/britter
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by Oliver Heger <ol...@oliver-heger.de>.
Am 18.03.2013 11:19, schrieb sebb:
> On 18 March 2013 10:07, Benedikt Ritter <br...@apache.org> wrote:
>> 2013/3/18 sebb <se...@gmail.com>
>>
>>> The new utils.mime classes for MIME decoding are mostly package-protected.
>>>
>>> However, they have public methods (and ctors) which is a bit misleading.
>>>
>>> I think it would make sense to reduce the visibility to package protected.
>>>
>>> Any objections?
>>>
>>
>> I personally don't align visibility of methods to the defining classes
>> visibility. If you decide to change the classes visibility to public you
>> will have to go though all methods and change method visibility too...
>
> Well yes, of course.
> But these classes are specifically for internal use only.
>
> Also I think objects should be created with the minimum visibility required.
> If it turns out more visibility is needed, it can be changed without
> causing incompatibility.
> Reducing visibility after release is not so easy.
>

Sorry, I disagree here. The classes affected are not part of the public 
API, so the argument of reducing visibility does not hold.

OTOH, different visibility of methods is a hint which methods are 
expected to be called from outside and which are internal helper methods.

Oliver


>> Benedikt
>>
>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>>
>> --
>> http://people.apache.org/~britter/
>> http://www.systemoutprintln.de/
>> http://twitter.com/BenediktRitter
>> http://github.com/britter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by Gary Gregory <ga...@gmail.com>.
+1

Gary

On Mar 18, 2013, at 6:20, sebb <se...@gmail.com> wrote:

> On 18 March 2013 10:07, Benedikt Ritter <br...@apache.org> wrote:
>> 2013/3/18 sebb <se...@gmail.com>
>>
>>> The new utils.mime classes for MIME decoding are mostly package-protected.
>>>
>>> However, they have public methods (and ctors) which is a bit misleading.
>>>
>>> I think it would make sense to reduce the visibility to package protected.
>>>
>>> Any objections?
>>
>> I personally don't align visibility of methods to the defining classes
>> visibility. If you decide to change the classes visibility to public you
>> will have to go though all methods and change method visibility too...
>
> Well yes, of course.
> But these classes are specifically for internal use only.
>
> Also I think objects should be created with the minimum visibility required.
> If it turns out more visibility is needed, it can be changed without
> causing incompatibility.
> Reducing visibility after release is not so easy.
>
>> Benedikt
>>
>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>> --
>> http://people.apache.org/~britter/
>> http://www.systemoutprintln.de/
>> http://twitter.com/BenediktRitter
>> http://github.com/britter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by sebb <se...@gmail.com>.
On 18 March 2013 10:07, Benedikt Ritter <br...@apache.org> wrote:
> 2013/3/18 sebb <se...@gmail.com>
>
>> The new utils.mime classes for MIME decoding are mostly package-protected.
>>
>> However, they have public methods (and ctors) which is a bit misleading.
>>
>> I think it would make sense to reduce the visibility to package protected.
>>
>> Any objections?
>>
>
> I personally don't align visibility of methods to the defining classes
> visibility. If you decide to change the classes visibility to public you
> will have to go though all methods and change method visibility too...

Well yes, of course.
But these classes are specifically for internal use only.

Also I think objects should be created with the minimum visibility required.
If it turns out more visibility is needed, it can be changed without
causing incompatibility.
Reducing visibility after release is not so easy.

> Benedikt
>
>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by Benedikt Ritter <br...@apache.org>.
2013/3/18 sebb <se...@gmail.com>

> The new utils.mime classes for MIME decoding are mostly package-protected.
>
> However, they have public methods (and ctors) which is a bit misleading.
>
> I think it would make sense to reduce the visibility to package protected.
>
> Any objections?
>

I personally don't align visibility of methods to the defining classes
visibility. If you decide to change the classes visibility to public you
will have to go though all methods and change method visibility too...

Benedikt


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: [FILEUPLOAD] Package protected classes have public methods - make these package protected?

Posted by Simone Tripodi <si...@apache.org>.
> The new utils.mime classes for MIME decoding are mostly package-protected.
>
> However, they have public methods (and ctors) which is a bit misleading.
>
> I think it would make sense to reduce the visibility to package protected.
>
> Any objections?
>

No objections

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/


On Mon, Mar 18, 2013 at 10:54 AM, sebb <se...@gmail.com> wrote:
> The new utils.mime classes for MIME decoding are mostly package-protected.
>
> However, they have public methods (and ctors) which is a bit misleading.
>
> I think it would make sense to reduce the visibility to package protected.
>
> Any objections?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org