You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2002/07/09 22:56:29 UTC

[lang] Naming conventions

This must be decided before promotion to commons proper.

There are two choices on offer -

1) Xxxs, such as Strings, Numbers etc.

2) XxxUtils, such as StringUtils, NumberUtils, etc.

I favour (2), for consistency with all the other commons areas (BeanUtils,
Collections, IO, Patterns).
I tried to find previous discussion on this in the archive, but could find
none. Opinions?

Stephen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang] Naming conventions

Posted by "Michael A. Smith" <ma...@apache.org>.
On Tue, 9 Jul 2002, Stephen Colebourne wrote:

> This must be decided before promotion to commons proper.
> 
> There are two choices on offer -
> 
> 1) Xxxs, such as Strings, Numbers etc.
> 
> 2) XxxUtils, such as StringUtils, NumberUtils, etc.
> 
> I favour (2), for consistency with all the other commons areas (BeanUtils,
> Collections, IO, Patterns).
> I tried to find previous discussion on this in the archive, but could find
> none. Opinions?

I prefer 2 for consistency with other commons components.

regards,
michael 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang] Naming conventions

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Henri Yandell" <ba...@generationjava.com>
> I'm happy to remove my #1 as I seem to be the only one in favour. I'm
> mainly concerned that we're going to keep changing our minds over each
> period.

In collections we wrote a developers guide that stated the convention. This
probably then makes it harder to change again.

> Stephen, can you please highlight each name change you would expect to
> happen in Lang. Does any class with a bunch of static methods and no
> reason to be constructed have 'Utils' added as a pattern convention?

Yes, that would be my definition.

NumberUtils
ObjectUtils
RandomStringUtils
SerializationUtils
StringUtils

are thus created.

Stephen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang] Naming conventions

Posted by Henri Yandell <ba...@generationjava.com>.
I'm happy to remove my #1 as I seem to be the only one in favour. I'm
mainly concerned that we're going to keep changing our minds over each
period.

Stephen, can you please highlight each name change you would expect to
happen in Lang. Does any class with a bunch of static methods and no
reason to be constructed have 'Utils' added as a pattern convention?

Hen

On Sun, 14 Jul 2002, Stephen Colebourne wrote:

> From: "Henri Yandell" <ba...@generationjava.com>
> > > > There are two choices on offer -
> > > >
> > > > 1) Xxxs, such as Strings, Numbers etc.
> > > >
> > > > 2) XxxUtils, such as StringUtils, NumberUtils, etc.
>
> Opinions so far (in order of sending):
> Stephen Colebourne: #2
> Steven Caswell: #2 (non-binding)
> Michael Smith: #2
> Henri Yandell: #1
>
> Reasons so far.
> For #1
> > From Henri Yandell:
> > I favour (1) for consistency with java.util. Arrays/Collections. Also with
> > java.beans.Beans. The only example of (2) I'm aware of is SwingUtilities,
> > and this raises the issue of the 'Utils' abbreviation. Plus it's a utility
> > for a product and not a single class.
> > I think that (1) reads better.
>
> Against #1
> > From Henri Yandell:
> > On the negative side for 'Strings' etc, it could sound like a vague form
> > of collection of String, rather than a series of functions [static
> > methods] for acting upon String objects.
>
>
> For #2
> > From Michael Smith:
> > for consistency with other commons components.
> > From Steven Caswell:
> > IMHO the name is more descriptive of the actual class intent than #1.
> > From Stephen Colebourne
> > I favour (2), for consistency with all the other commons areas (BeanUtils,
> Collections, IO, Patterns).
> Also by not encroaching on the Java naming convention, we allow for Java to
> add a class called Strings in the future for example.
>
> Against #2
> > From Henri Yandell:
> > The abbreviation.
> > It reads poorly.
> > Still has the plural problem, xxxUtils does not contain many Util, unless
> > each function is believed to be a Util. xxxUtil would be the more logical
> > case and is the one Commons.IO appears to have partially implemented.
> > RandomString would become RandomStringUtils?
> > Serialization would become SerializationUtils?
> > What exactly is a Util?
>
>
> Comment:
> This seems to be a question of consistency with Apache Commons versus
> consistency with Java. I also believe that the Utils suffix makes it obvious
> to a user that this is a non-instantiable class of util methods (answering
> your question Henri, yes each method is a util).
>
> Stephen
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [lang] Naming conventions

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Henri Yandell" <ba...@generationjava.com>
> > > There are two choices on offer -
> > >
> > > 1) Xxxs, such as Strings, Numbers etc.
> > >
> > > 2) XxxUtils, such as StringUtils, NumberUtils, etc.

Opinions so far (in order of sending):
Stephen Colebourne: #2
Steven Caswell: #2 (non-binding)
Michael Smith: #2
Henri Yandell: #1

Reasons so far.
For #1
> From Henri Yandell:
> I favour (1) for consistency with java.util. Arrays/Collections. Also with
> java.beans.Beans. The only example of (2) I'm aware of is SwingUtilities,
> and this raises the issue of the 'Utils' abbreviation. Plus it's a utility
> for a product and not a single class.
> I think that (1) reads better.

Against #1
> From Henri Yandell:
> On the negative side for 'Strings' etc, it could sound like a vague form
> of collection of String, rather than a series of functions [static
> methods] for acting upon String objects.


For #2
> From Michael Smith:
> for consistency with other commons components.
> From Steven Caswell:
> IMHO the name is more descriptive of the actual class intent than #1.
> From Stephen Colebourne
> I favour (2), for consistency with all the other commons areas (BeanUtils,
Collections, IO, Patterns).
Also by not encroaching on the Java naming convention, we allow for Java to
add a class called Strings in the future for example.

Against #2
> From Henri Yandell:
> The abbreviation.
> It reads poorly.
> Still has the plural problem, xxxUtils does not contain many Util, unless
> each function is believed to be a Util. xxxUtil would be the more logical
> case and is the one Commons.IO appears to have partially implemented.
> RandomString would become RandomStringUtils?
> Serialization would become SerializationUtils?
> What exactly is a Util?


Comment:
This seems to be a question of consistency with Apache Commons versus
consistency with Java. I also believe that the Utils suffix makes it obvious
to a user that this is a non-instantiable class of util methods (answering
your question Henri, yes each method is a util).

Stephen



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [lang] Naming conventions

Posted by "Michael A. Smith" <ma...@apache.org>.
On Sun, 14 Jul 2002, Henri Yandell wrote:
> I favour (1) for consistency with java.util. Arrays/Collections. Also with
> java.beans.Beans. The only example of (2) I'm aware of is SwingUtilities,
> and this raises the issue of the 'Utils' abbreviation. Plus it's a utility
> for a product and not a single class.
> I think that (1) reads better.

javax.servlet.http.HttpUtils

It was depracated in the 2.3 servlet spec since the functionality was
moved to the request interfaces, but I thought I'd mention it anyway.  

http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpUtils.html


regards,
michael


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [lang] Naming conventions

Posted by Henri Yandell <ba...@generationjava.com>.

> > From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> >
> > This must be decided before promotion to commons proper.

Time to iron it out then :)

> >
> > There are two choices on offer -
> >
> > 1) Xxxs, such as Strings, Numbers etc.
> >
> > 2) XxxUtils, such as StringUtils, NumberUtils, etc.
> >
> > I favour (2), for consistency with all the other commons
> > areas (BeanUtils, Collections, IO, Patterns). I tried to find
> > previous discussion on this in the archive, but could find
> > none. Opinions?

I favour (1) for consistency with java.util. Arrays/Collections. Also with
java.beans.Beans. The only example of (2) I'm aware of is SwingUtilities,
and this raises the issue of the 'Utils' abbreviation. Plus it's a utility
for a product and not a single class.
I think that (1) reads better.

On the negative side for 'Strings' etc, it could sound like a vague form
of collection of String, rather than a series of functions [static
methods] for acting upon String objects.
org.apache.commons.lang.StringFunctions sounds a bit clunky though.
Another negative is that some other apache projects use the Util naming
convention. The IO project was intended to use Files and not FileUtils.
The Collections project couldn't use Collections due to JDK clashes and
stuck with Util.

The original discussion is viewable from:

http://marc.theaimsgroup.com/?l=jakarta-commons-dev&m=101424087610102&w=2

Negatives for xxxUtils:

The abbreviation.
It reads poorly.
Still has the plural problem, xxxUtils does not contain many Util, unless
each function is believed to be a Util. xxxUtil would be the more logical
case and is the one Commons.IO appears to have partially implemented.
RandomString would become RandomStringUtils?
Serialization would become SerializationUtils?
What exactly is a Util?


Hen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [lang] Naming conventions

Posted by Steven Caswell <st...@caswell.name>.
I also favor #2. IMHO the name is more descriptive of the actual class
intent than #1.


Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: Stephen Colebourne [mailto:scolebourne@btopenworld.com] 
> Sent: Tuesday, July 09, 2002 3:56 PM
> To: Jakarta Commons Developers List
> Subject: [lang] Naming conventions
> 
> 
> This must be decided before promotion to commons proper.
> 
> There are two choices on offer -
> 
> 1) Xxxs, such as Strings, Numbers etc.
> 
> 2) XxxUtils, such as StringUtils, NumberUtils, etc.
> 
> I favour (2), for consistency with all the other commons 
> areas (BeanUtils, Collections, IO, Patterns). I tried to find 
> previous discussion on this in the archive, but could find 
> none. Opinions?
> 
> Stephen
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>