Placing new names under standard namespaces?

Discussion in 'Ruby' started by Ammar Ali, Oct 25, 2010.

  1. Ammar Ali

    Ammar Ali Guest

    Someone recently pointed out that placing new classes and modules
    under standard library namespaces, like Time::Tree or
    Hash::Transforms, is frowned upon.

    I find this approach increases readability and keeps related things
    nicely organized. At the same time I understand that there is a
    (slight?) risk of name collisions.

    I'm curious what others think, and if there are other risks to be considered.

    Regards,
    Ammar
     
    Ammar Ali, Oct 25, 2010
    #1
    1. Advertising

  2. On Mon, Oct 25, 2010 at 11:41 AM, Ammar Ali <> wrote:
    > Someone recently pointed out that placing new classes and modules
    > under standard library namespaces, like Time::Tree or
    > Hash::Transforms, is frowned upon.
    >
    > I find this approach increases readability and keeps related things
    > nicely organized. At the same time I understand that there is a
    > (slight?) risk of name collisions.
    >
    > I'm curious what others think, and if there are other risks to be considered.


    I can see both positions: changing built in / std lib classes is
    typically considered dangerous and a don't. OTOH if you create
    extensions e.g. for class Time which are universal (i.e. multiple
    users of Time can benefit from this) nesting might not be a too bad
    idea. I'd be cautious though.

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
     
    Robert Klemme, Oct 25, 2010
    #2
    1. Advertising

  3. Ammar Ali

    Ammar Ali Guest

    On Mon, Oct 25, 2010 at 2:55 PM, Robert Klemme
    <> wrote:
    >
    > I can see both positions: changing built in / std lib classes is
    > typically considered dangerous and a don't. =C2=A0OTOH if you create
    > extensions e.g. for class Time which are universal (i.e. multiple
    > users of Time can benefit from this) nesting might not be a too bad
    > idea. =C2=A0I'd be cautious though.


    Thanks. Drawing a distinction between universal extensions and
    extensions that are less so is a helpful rule. And thanks for pointing
    out the distinction between built in and std lib classes. I should
    stop referring to both as std lib.

    Cheers,
    Ammar
     
    Ammar Ali, Oct 25, 2010
    #3
    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. Dan Rawson
    Replies:
    3
    Views:
    317
    Andrew Dalke
    Aug 13, 2003
  2. Lonnie Princehouse
    Replies:
    6
    Views:
    328
  3. Replies:
    2
    Views:
    518
  4. Replies:
    4
    Views:
    506
    Joe Kesselman
    Feb 25, 2007
  5. Replies:
    7
    Views:
    314
    Andrew Koenig
    May 9, 2008
Loading...

Share This Page