Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Naming Convention for Columns

Re: Naming Convention for Columns

From: Alvin Sylvain <alvin_at_NO.JUNK>
Date: 1998/03/07
Message-ID: <01bd497c$c125e360$bc87d9cf@rana>#1/1

Todd Boss <boss_at_netcom.com> wrote in article <bossEpEqsK.Ctr_at_netcom.com>...
> In article <01bd48d0$1252b6d0$b187d9cf_at_rana>,
> Alvin Sylvain <alvin_at_NO.JUNK> wrote:
> >Dave Mullen <dave.mullen_at_emjay.com> wrote in article
> ><6dnbes$6r5_at_newsops.execpc.com>...
> >
> >First off, I hate naming conventions altogether. Most important:
> >do one thing, and do it consistently. But don't have heartburn
> >if someone doesn't quite come up to snuff.
> >
> >We had three different spellings of "invoice number":
> > invc_nbr, invc_no, invc_num.
> >
> >Ouch.
> >
> >The problem in writing code for this mess was remembering which
> >table had which spelling, particularly in joins. You compile and
> >test something three times before you get it right. We fixed the
> >problem before it got too far.
>
> So, let me see, you hate naming conventions, but then a situation
 arises
> that really pisses you off, but which could have been avoided by,
 yes,
> having naming conventions!

You got me there. What can I say? We didn't need to have a "naming convention" per se, just a consistent way of naming things. Eg, we could have named it "invc_no" every where for "Invoice Number", but still use a full spelling for something else, such as "company_name", vs. "co_name".

We fixed it, but you have no idea how much code we broke fixing it! Which had to be fixed.   

> >One rule you might want to consider, and the reason for it: name
> >the columns with long, self-descriptive, correctly spelled words.
> >Ie, instead of "invc_nbr", it should be "InvoiceNumber". Or,
> >perhaps, "Invoice_Number". Again, do it consistently: that way,
> >you don't have to *remember* whether or not an underline is in
> >the word: it either always is or always isn't.
>
> Be consistent. NEVER mix upper and lower case in column names. You
> won't believe how much hair you'll rip out the 5th time you've
 retyped
> a simple query b/c you have mixed case in Sybase.

This is very good advice, particularly considering that you never know when you'll have to port to a database that doesn't support mixed case anyway, and it'll just be dumb luck that thru the process of mangling by multiple maintainers, to get something like both "lcFlag" and "lcflag" in the same table. (Hey, in 200+ columns and the 8th person to "fix" something, it could happen!)

A. Received on Sat Mar 07 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US