Class/Module Naming Best Practice for Acronyms

Discussion in 'Ruby' started by Intransition, Aug 14, 2009.

  1. Intransition

    Intransition Guest

    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::Document -or- Xml::Document

    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.
    Intransition, Aug 14, 2009
    #1
    1. Advertising

  2. Intransition

    pharrington Guest

    On Aug 14, 11:17 am, Intransition <> 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::Document  -or-  Xml::Document
    >
    >   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?)
    pharrington, Aug 14, 2009
    #2
    1. Advertising

  3. Intransition wrote:
    > XML::Document -or- Xml::Document


    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
    Joel VanderWerf, Aug 14, 2009
    #3
  4. [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!
    Fabian Streitel, Aug 14, 2009
    #4
  5. Hi --

    On Sat, 15 Aug 2009, Joel VanderWerf wrote:

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

    >
    > 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
    David A. Black, Aug 14, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rob@codebox

    Java versions, acronyms and names

    rob@codebox, Jan 6, 2007, in forum: Java
    Replies:
    2
    Views:
    313
    rob@codebox
    Jan 7, 2007
  2. acronyms ??!!

    , Jan 18, 2007, in forum: Java
    Replies:
    2
    Views:
    466
    Alex Hunsley
    Jan 19, 2007
  3. Terry Reedy

    Explain your acronyms (RSI?)

    Terry Reedy, Jul 6, 2013, in forum: Python
    Replies:
    3
    Views:
    75
    Rotwang
    Jul 6, 2013
  4. Benjamin Kaplan

    Re: Explain your acronyms (RSI?)

    Benjamin Kaplan, Jul 6, 2013, in forum: Python
    Replies:
    0
    Views:
    78
    Benjamin Kaplan
    Jul 6, 2013
  5. Robert Kern

    Re: Explain your acronyms (RSI?)

    Robert Kern, Jul 6, 2013, in forum: Python
    Replies:
    0
    Views:
    69
    Robert Kern
    Jul 6, 2013
Loading...

Share This Page