Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Class/Module Naming Best Practice for Acronyms

Reply
Thread Tools

Class/Module Naming Best Practice for Acronyms

 
 
Intransition
Guest
Posts: n/a
 
      08-14-2009
If you are encapsulating something that is generally referred to by an
acronym, is it better to use all caps, even though in Ruby that
usually indicates a constant value of some sort other than a class or
module. Or is better to capitalize the term so it conforms to the
typical look of class/module names.

Eg.

XML:ocument -or- Xml:ocument

POM::Metadata -or- Pom::Metadata

ANSI::Code -or- Ansi::Code

I can't seem to ever make up my mind about this, so I thought I'd ask
and see if there is some sort of general consensus or if someone else
has some sort of concrete basis on which to decide.

 
Reply With Quote
 
 
 
 
pharrington
Guest
Posts: n/a
 
      08-14-2009
On Aug 14, 11:17*am, Intransition <(E-Mail Removed)> wrote:
> If you are encapsulating something that is generally referred to by an
> acronym, is it better to use all caps, even though in Ruby that
> usually indicates a constant value of some sort other than a class or
> module. Or is better to capitalize the term so it conforms to the
> typical look of class/module names.
>
> Eg.
>
> * XML:ocument *-or- *Xml:ocument
>
> * POM::Metadata *-or- *Pom::Metadata
>
> * ANSI::Code * * -or- *Ansi::Code
>
> I can't seem to ever make up my mind about this, so I thought I'd ask
> and see if there is some sort of general consensus or if someone else
> has some sort of concrete basis on which to decide.


POM is delicious.

so POM should be capitalized.

(but I myself use all caps for module/class names when such matches
the actual spelling, and libraries such as Nokogiri and JSON seem to
do this too, so that seems like the expected way of doing?)
 
Reply With Quote
 
 
 
 
Joel VanderWerf
Guest
Posts: n/a
 
      08-14-2009
Intransition wrote:
> XML:ocument -or- Xml:ocument


It's actually hard for me to type Xml rather than XML or xml.

I prefer the former style. Doesn't bother me that it looks like
non-module constants.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

 
Reply With Quote
 
Fabian Streitel
Guest
Posts: n/a
 
      08-14-2009
[Note: parts of this message were removed to make it a legal post.]

>
> (but I myself use all caps for module/class names when such matches
> the actual spelling, and libraries such as Nokogiri and JSON seem to
> do this too, so that seems like the expected way of doing?)
>


I second that. If you'd write it all caps in a text document, why not in
source code?

Greetz!

 
Reply With Quote
 
David A. Black
Guest
Posts: n/a
 
      08-14-2009
Hi --

On Sat, 15 Aug 2009, Joel VanderWerf wrote:

> Intransition wrote:
>> XML:ocument -or- Xml:ocument

>
> It's actually hard for me to type Xml rather than XML or xml.
>
> I prefer the former style. Doesn't bother me that it looks like non-module
> constants.


I agree, and it seems to be standard practice in the standard library
(YAML, Net::HTTP, ERB, etc.).


David

--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Q: What's the best way to get a really solid knowledge of Ruby?
A: Come to our Ruby training in Edison, New Jersey, September 14-17!
Instructors: David A. Black and Erik Kastner
More info and registration: http://rubyurl.com/vmzN

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Acronyms? Andrew MCSE 6 09-06-2006 02:53 PM
Remember when your piano teacher taught you, "Practice, practice,practice ...?" Wayne Wastier Windows 64bit 3 06-10-2005 08:29 PM
Acronyms 2003 70-290 Track Marlin Munrow MCSE 0 02-22-2004 03:30 PM
RFC's and acronyms G. Orme MCSE 8 01-19-2004 04:51 PM



Advertisments