You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jeff Varszegi <jv...@yahoo.com> on 2002/11/17 00:25:06 UTC

[all]Naming conventions (where do I find 'em?)

I was looking over the FastArrayList class (which I like) and noticed the methods setFast(boolean)
and getFast().  In my opinion, these would better (and more standardly) be named
'setFastModeEnabled' and 'isFastModeEnabled'.  At the very least, shouldn't getFast() be named
'isFast'?  It's a boolean indicator.

For another example, I also noticed methods called 'getNumActive' and 'getNumIdle' in ObjectPool. 
I think these would be better named 'getActiveCount' and 'getIdleCount' or something similar. 
This would reduce the unnecessary use of abbreviations and be more like stuff found elsewhere in
Java.

I'm not on a high horse-- what I'm really wondering is

1. Are there naming standards to which the Jakarta community adheres?
2. Is everything that has been previously named set in stone?  (If so, I won't bring such things
up.)

Thanks a lot.

Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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


Re: [all]Naming conventions (where do I find 'em?)

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Jeff Varszegi" <jv...@yahoo.com>
> 1. Are there naming standards to which the Jakarta community adheres?
Current commons charter states that each commons subproject choses its own
standards. [Collections] has a document called developers-guide.html. It
would certainly make sense to expand on this for [collections] and add a new
file for [lang]

> 2. Is everything that has been previously named set in stone?  (If so, I
won't bring such things
> up.)
Pretty much. The commons charter says that we aim to really minimise API
change, as we are the low level utilities. Each case should be considered on
its own merits though as it comes up.

Stephen


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


Re: [PROPOSAL] set a standard location for a component's coding standards

Posted by Scott Sanders <sa...@apache.org>.
On Mon, Nov 18, 2002 at 07:12:12PM +0000, robert burrell donkin wrote:
> PROPOSAL
> ========
> components are supposed to adhere to the jakarta coding standards (ie. the 
> sun coding standards) unless they document the coding standards they use. 
> at the moment, this document can be located anywhere and is therefore 
> difficult to find. it therefore seems sensible to choose a standard 
> filename and location for this file.
> 
> i think that it'd be easier to establish the principle before choosing a 
> name and location but anyone who has any good ideas is very welcome to 
> propose them now.
> 

I would prefer that it be listed in the STATUS file, or least have a link from the STATUS file.

I also like the collections DEVELOPERS-GUIDE concept.


-- 
Scott Sanders - sanders@apache.org

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


Re: [PROPOSAL] set a standard location for a component's coding standards

Posted by Stephen Colebourne <sc...@btopenworld.com>.
+1
The [collections] version is DEVELOPER-GUIDE.html in the root
Stephen

----- Original Message -----
From: "robert burrell donkin" <ro...@blueyonder.co.uk>


> PROPOSAL
> ========
> components are supposed to adhere to the jakarta coding standards (ie. the
> sun coding standards) unless they document the coding standards they use.
> at the moment, this document can be located anywhere and is therefore
> difficult to find. it therefore seems sensible to choose a standard
> filename and location for this file.
>
> i think that it'd be easier to establish the principle before choosing a
> name and location but anyone who has any good ideas is very welcome to
> propose them now.
>
> - robert
>
>
> --
> 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>


[PROPOSAL] set a standard location for a component's coding standards

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
PROPOSAL
========
components are supposed to adhere to the jakarta coding standards (ie. the 
sun coding standards) unless they document the coding standards they use. 
at the moment, this document can be located anywhere and is therefore 
difficult to find. it therefore seems sensible to choose a standard 
filename and location for this file.

i think that it'd be easier to establish the principle before choosing a 
name and location but anyone who has any good ideas is very welcome to 
propose them now.

- robert


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


Re: [lang][SUBMIT] Some utility classes for generating IDs

Posted by Henri Yandell <ba...@generationjava.com>.
Nah, there's actually a jakarta-commons-sandbox project called Patterns.
Stephen used it to do some research work, most of which has ended up in
the Lang tree now:

http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/pattern/src/java/org/apache/commons/pattern/identifier/

I liked the XML parser, was fun to make, but didn't seem any point in
competing with all the others, NanoXml etc. Weirdly, this is the second
time it's been mentioned this week as a port I made to LPC[Pike-like
language] looks like it might get used somewhere :)

Hen

On Sun, 17 Nov 2002, Jeff Varszegi wrote:

> I agree with you.  By Patterns were you referring to Betwixt?  I
> checked out your website.  Your tiny XML parser is nice-- I did
> something very similar about a year ago. -Jeff
>
> --- Henri Yandell <ba...@generationjava.com> wrote:
> >
> > There are some ID generating bits in the Commons Sandbox. In the Patterns
> > project and I think there's one in the Util project.
> >
> > Neither have yet made their way into a release project yet. I've been
> > pondering whether something like this would go in DbUtils, but the
> > database specificness gets quite painful.
> >
> > So as far as Lang goes, I'm not sure :) They've always seemed a bit above
> > Lang's basic aims.
> >
> > Hen
> >
> > On Sat, 16 Nov 2002, Jeff Varszegi wrote:
> >
> > > I use these to generate IDs for EJBs and in a couple of other ways.  Does anyone think they
> > could
> > > be usefully included in a project?  I did look around to see if there was something already in
> > > Commons for this, but I didn't see anything.
> > >
> > > The IDGenerator interface provides one method, generateID().  A few implementations are
> > provided,
> > > including one that generates 32-character UUIDs.  A lookup class is also provided for
> > acquiring an
> > > IDGenerator by name.
> > >
> > > Jeff
> > >
> > >
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Web Hosting - Let the expert host your site
> > > http://webhosting.yahoo.com
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> --
> 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][SUBMIT] Some utility classes for generating IDs

Posted by Jeff Varszegi <jv...@yahoo.com>.
I agree with you.  By Patterns were you referring to Betwixt?  I checked out your website.  Your
tiny XML parser is nice-- I did something very similar about a year ago. -Jeff

--- Henri Yandell <ba...@generationjava.com> wrote:
> 
> There are some ID generating bits in the Commons Sandbox. In the Patterns
> project and I think there's one in the Util project.
> 
> Neither have yet made their way into a release project yet. I've been
> pondering whether something like this would go in DbUtils, but the
> database specificness gets quite painful.
> 
> So as far as Lang goes, I'm not sure :) They've always seemed a bit above
> Lang's basic aims.
> 
> Hen
> 
> On Sat, 16 Nov 2002, Jeff Varszegi wrote:
> 
> > I use these to generate IDs for EJBs and in a couple of other ways.  Does anyone think they
> could
> > be usefully included in a project?  I did look around to see if there was something already in
> > Commons for this, but I didn't see anything.
> >
> > The IDGenerator interface provides one method, generateID().  A few implementations are
> provided,
> > including one that generates 32-character UUIDs.  A lookup class is also provided for
> acquiring an
> > IDGenerator by name.
> >
> > Jeff
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - Let the expert host your site
> > http://webhosting.yahoo.com
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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


Re: [lang][SUBMIT] Some utility classes for generating IDs

Posted by Henri Yandell <ba...@generationjava.com>.
There are some ID generating bits in the Commons Sandbox. In the Patterns
project and I think there's one in the Util project.

Neither have yet made their way into a release project yet. I've been
pondering whether something like this would go in DbUtils, but the
database specificness gets quite painful.

So as far as Lang goes, I'm not sure :) They've always seemed a bit above
Lang's basic aims.

Hen

On Sat, 16 Nov 2002, Jeff Varszegi wrote:

> I use these to generate IDs for EJBs and in a couple of other ways.  Does anyone think they could
> be usefully included in a project?  I did look around to see if there was something already in
> Commons for this, but I didn't see anything.
>
> The IDGenerator interface provides one method, generateID().  A few implementations are provided,
> including one that generates 32-character UUIDs.  A lookup class is also provided for acquiring an
> IDGenerator by name.
>
> Jeff
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com


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


[lang][SUBMIT] Some utility classes for generating IDs

Posted by Jeff Varszegi <jv...@yahoo.com>.
Sorry I forgot to put the SUBMIT tag on the preceding email.  -Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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


[lang] Some utility classes for generating IDs

Posted by Jeff Varszegi <jv...@yahoo.com>.
I use these to generate IDs for EJBs and in a couple of other ways.  Does anyone think they could
be usefully included in a project?  I did look around to see if there was something already in
Commons for this, but I didn't see anything.

The IDGenerator interface provides one method, generateID().  A few implementations are provided,
including one that generates 32-character UUIDs.  A lookup class is also provided for acquiring an
IDGenerator by name.

Jeff


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: [all]Naming conventions (where do I find 'em?)

Posted by Henri Yandell <ba...@generationjava.com>.
Must finish the inbox before replying, *slaps self*.

Hen

On Sat, 16 Nov 2002, Henri Yandell wrote:

>
>
> On Sat, 16 Nov 2002, Jeff Varszegi wrote:
>
> > I was looking over the FastArrayList class (which I like) and noticed the methods setFast(boolean)
> > and getFast().  In my opinion, these would better (and more standardly) be named
> > 'setFastModeEnabled' and 'isFastModeEnabled'.  At the very least, shouldn't getFast() be named
> > 'isFast'?  It's a boolean indicator.
>
> I'd agree, but getFast is legal for a boolean too.
>
> > For another example, I also noticed methods called 'getNumActive' and
> 'getNumIdle' in ObjectPool.
> > I think these would be better named 'getActiveCount' and
> > 'getIdleCount' or something similar.  This would reduce the
> > unnecessary use of abbreviations and be more like stuff found
> > elsewhere in Java.
>
> Abbreviations are bad, true.
>
> > 1. Are there naming standards to which the Jakarta community adheres?
>
> The Sun coding standards are often adhered to. There are some other
> Jakarta projects which have coding standards, Turbine do I think, and
> Avalon might as well. Tomcat? And their standards are often chosen by
> particular projects in Commons.
>
> > 2. Is everything that has been previously named set in stone?  (If so,
> > I won't bring such things up.)
>
> Depends on releases ususally. Things have to be slowly deprecated for a
> rename and often it's not worth the 2 or 3 releases worth of management.
>
> I agree with both of your renamings though. The renamed ones make more
> sense if they could be applied.
>
> My tuppence,
>
> Hen
>
>
> --
> 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: [all]Naming conventions (where do I find 'em?)

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Sunday, November 17, 2002, at 08:05 PM, Jeff Varszegi wrote:

> Thanks for your thoughtful reply.  I think that code that has standard 
> naming conventions is
> easier for people to understand, and makes it more likely to be adopted 
> (in addition to making it
> look more professional).  Maybe it comes from my English-geek background;
>  one of the things I love
> about object-oriented languages like Java is that my code turns out to 
> read almost like a story if
> I've taken time with the naming of things.
>
> I am having a blast digging through all the Jakarta projects for the 
> first time, but at first I
> was a little confused as to some of the website organization.  I just 
> figured I was missing the
> coding-standards documentation if I didn't immediately see any.

the web site has grown rather than been designed. this has advantages and 
disadvantages. it grows organically by the efforts of our contributors. so,
  if you can see an improvement, then why not submit a patch.

if you want to submit an improvement for a subproject site (eg. 
jakarata-commons) then you need to find out how their site is built and 
then either post your patch to their dev mailing list or add it to 
bugzilla. (jakarta-commons is build with anakia and the documents you need 
to patch live in the top level xdocs folder.)

if it's for the jakarta site, then you need should read

http://jakarta.apache.org/site/jakarta-site2.html

(though it's mainly aimed at committers) and then post your patches to 
general@jakarta.apache.org.

- robert


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


Re: [all]Naming conventions (where do I find 'em?)

Posted by Jeff Varszegi <jv...@yahoo.com>.
Thanks for your thoughtful reply.  I think that code that has standard naming conventions is
easier for people to understand, and makes it more likely to be adopted (in addition to making it
look more professional).  Maybe it comes from my English-geek background; one of the things I love
about object-oriented languages like Java is that my code turns out to read almost like a story if
I've taken time with the naming of things.

I am having a blast digging through all the Jakarta projects for the first time, but at first I
was a little confused as to some of the website organization.  I just figured I was missing the
coding-standards documentation if I didn't immediately see any.

Jeff

--- robert burrell donkin <ro...@blueyonder.co.uk> wrote:
> On Sunday, November 17, 2002, at 12:47 AM, Henri Yandell wrote:
> 
> > On Sat, 16 Nov 2002, Jeff Varszegi wrote:
> 
> <snip>
> 
> >> 1. Are there naming standards to which the Jakarta community adheres?
> >
> > The Sun coding standards are often adhered to. There are some other
> > Jakarta projects which have coding standards, Turbine do I think, and
> > Avalon might as well. Tomcat? And their standards are often chosen by
> > particular projects in Commons.
> 
> just for the record (and hopefully people will set me right if i go wrong)
> ...
> 
> jakarta uses lazy delegation for coding standards. jakarta has a top level 
> set of standards. but any subproject can override any standard or add 
> enhancements by explictly creating their own standards. components in the 
> commons can in addition lazily delegate from any commons subproject-level 
> coding standards.
> 
> avalon and turbine are two projects which have well developed (but 
> different) coding standards. a number of other subprojects use those 
> standards rather than creating their own.
> 
> AFAIK commons has been too lazy to draw up any coding standards and so we 
> default to the sun standards.
> 
> 
> where would you look to find coding standards for components?
> 
> IMHO they should be in the top level of the component's cvs folder. they 
> should probably have a specified name and format so that people can find 
> them. but at the moment, this hasn't been done. i'd say that this is an 
> oversight that needs correcting.
> 
> 
> >> 2. Is everything that has been previously named set in stone?  (If so,
> >> I won't bring such things up.)
> >
> > Depends on releases ususally. Things have to be slowly deprecated for a
> > rename and often it's not worth the 2 or 3 releases worth of management.
> >
> > I agree with both of your renamings though. The renamed ones make more
> > sense if they could be applied.
> 
> IMHO pure renaming is the easiest deprecation case to maintain. what's 
> crucial, though, is that time's taken to ensure that the improved names 
> are exactly right.
> 
> - robert
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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


Re: [all]Naming conventions (where do I find 'em?)

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Sunday, November 17, 2002, at 12:47 AM, Henri Yandell wrote:

> On Sat, 16 Nov 2002, Jeff Varszegi wrote:

<snip>

>> 1. Are there naming standards to which the Jakarta community adheres?
>
> The Sun coding standards are often adhered to. There are some other
> Jakarta projects which have coding standards, Turbine do I think, and
> Avalon might as well. Tomcat? And their standards are often chosen by
> particular projects in Commons.

just for the record (and hopefully people will set me right if i go wrong)
...

jakarta uses lazy delegation for coding standards. jakarta has a top level 
set of standards. but any subproject can override any standard or add 
enhancements by explictly creating their own standards. components in the 
commons can in addition lazily delegate from any commons subproject-level 
coding standards.

avalon and turbine are two projects which have well developed (but 
different) coding standards. a number of other subprojects use those 
standards rather than creating their own.

AFAIK commons has been too lazy to draw up any coding standards and so we 
default to the sun standards.


where would you look to find coding standards for components?

IMHO they should be in the top level of the component's cvs folder. they 
should probably have a specified name and format so that people can find 
them. but at the moment, this hasn't been done. i'd say that this is an 
oversight that needs correcting.


>> 2. Is everything that has been previously named set in stone?  (If so,
>> I won't bring such things up.)
>
> Depends on releases ususally. Things have to be slowly deprecated for a
> rename and often it's not worth the 2 or 3 releases worth of management.
>
> I agree with both of your renamings though. The renamed ones make more
> sense if they could be applied.

IMHO pure renaming is the easiest deprecation case to maintain. what's 
crucial, though, is that time's taken to ensure that the improved names 
are exactly right.

- robert


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


Re: [all]Naming conventions (where do I find 'em?)

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

On Sat, 16 Nov 2002, Jeff Varszegi wrote:

> I was looking over the FastArrayList class (which I like) and noticed the methods setFast(boolean)
> and getFast().  In my opinion, these would better (and more standardly) be named
> 'setFastModeEnabled' and 'isFastModeEnabled'.  At the very least, shouldn't getFast() be named
> 'isFast'?  It's a boolean indicator.

I'd agree, but getFast is legal for a boolean too.

> For another example, I also noticed methods called 'getNumActive' and
'getNumIdle' in ObjectPool.
> I think these would be better named 'getActiveCount' and
> 'getIdleCount' or something similar.  This would reduce the
> unnecessary use of abbreviations and be more like stuff found
> elsewhere in Java.

Abbreviations are bad, true.

> 1. Are there naming standards to which the Jakarta community adheres?

The Sun coding standards are often adhered to. There are some other
Jakarta projects which have coding standards, Turbine do I think, and
Avalon might as well. Tomcat? And their standards are often chosen by
particular projects in Commons.

> 2. Is everything that has been previously named set in stone?  (If so,
> I won't bring such things up.)

Depends on releases ususally. Things have to be slowly deprecated for a
rename and often it's not worth the 2 or 3 releases worth of management.

I agree with both of your renamings though. The renamed ones make more
sense if they could be applied.

My tuppence,

Hen


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


Re: [lang] Performance enhancement for SerializationUtils

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Thanks for this advice, I've included it in the CVS.

(I've added specific comments for the stream methods about buffering)

Stephen

----- Original Message -----
From: "Jeff Varszegi" <jv...@yahoo.com>
> Here is the code for the serialize(Serializable) method:
>
>     public static byte[] serialize(Serializable obj) {
>         ByteArrayOutputStream baos = new ByteArrayOutputStream();
>         serialize(obj, baos);
>         return baos.toByteArray();
>     }
>
> This can be sped up a significant amount just by using a different
constructor for the
> ByteArrayInputStream instance, passing in a number higher than 32, so it
constructs a bigger
> initial buffer than it otherwise would.  Bumping up the initial buffer
size to 128 worked about as
> well as bumping it up to 512 on my machine.
>
> This alone resulted in an overall 6% speed increase for the
clone(Serializable) method on my
> machine.
>
> For the methods serialize(Serializable, OutputStream) and
deserialize(InputStream) it may be
> desirable to wrap the passed streams in buffered streams.  Serialization
to/from streams is
> typically done for persistence, passing objects between JVMs, etc. and
it's not hard to imagine
> someone passing in unbuffered streams in these situations...
>
> Jeff
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> --
> 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>


[lang] Performance enhancement for SerializationUtils

Posted by Jeff Varszegi <jv...@yahoo.com>.
Here is the code for the serialize(Serializable) method:

    public static byte[] serialize(Serializable obj) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        serialize(obj, baos);
        return baos.toByteArray();
    }

This can be sped up a significant amount just by using a different constructor for the
ByteArrayInputStream instance, passing in a number higher than 32, so it constructs a bigger
initial buffer than it otherwise would.  Bumping up the initial buffer size to 128 worked about as
well as bumping it up to 512 on my machine.

This alone resulted in an overall 6% speed increase for the clone(Serializable) method on my
machine.

For the methods serialize(Serializable, OutputStream) and deserialize(InputStream) it may be
desirable to wrap the passed streams in buffered streams.  Serialization to/from streams is
typically done for persistence, passing objects between JVMs, etc. and it's not hard to imagine
someone passing in unbuffered streams in these situations...

Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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