Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Column naming standard – general opinions

0 views
Skip to first unread message

gargoyle60

unread,
Nov 20, 2009, 5:34:08 AM11/20/09
to
Don't want to start a long-winded discussion, just seeking some
general views. . .

I was trained in SQL years ago and was encouraged to use lower-case
letters with words separated for emphasis using the underscore
character, for example:
customer_num, employee_id, invoice_line, transaction_code

I've stuck with this approach ever since, but now that I make use of
oo programming the general standard is to name oo instance variables
without underscores and capitalising all words except the first for
emphasis, such as:
customerNum, employeeId, invoiceLine, transactionCode

However, bridging the gap between relational databases and oo
programming means that when binding table column names to object
variable names, I really need to pick one or the other (you may
disagree but that's my aim).

So, when it comes to naming columns, what are most of you using?

Willem Bogaerts

unread,
Nov 20, 2009, 5:46:51 AM11/20/09
to
> However, bridging the gap between relational databases and oo
> programming means that when binding table column names to object
> variable names, I really need to pick one or the other (you may
> disagree but that's my aim).

I don't see why column names have to be the same as property names. In
fact, it can be good to see what kind identifier it is. But if you have
already decided that they must be the same, just pick the most legible one.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

gargoyle60

unread,
Nov 20, 2009, 6:03:37 AM11/20/09
to
On Fri, 20 Nov 2009 11:46:51 +0100, Willem Bogaerts
<w.bog...@kratz.nl> wrote:

>I don't see why column names have to be the same as property names. In
>fact, it can be good to see what kind identifier it is. But if you have
>already decided that they must be the same, just pick the most legible one.

You're right, of course. I've just partially implemented a Facade
pattern which takes care of the translation via a ColumnMap for the
DatabaseBroker.

D Finnigan

unread,
Nov 20, 2009, 12:18:00 PM11/20/09
to
gargoyle60wrote:

>
> I was trained in SQL years ago and was encouraged to use lower-case
> letters with words separated for emphasis using the underscore
> character, for example:
> customer_num, employee_id, invoice_line, transaction_code
>

That's how I name my columns.

Captain Paralytic

unread,
Nov 20, 2009, 12:34:29 PM11/20/09
to
On 20 Nov, 10:34, gargoyle60 <gargoyl...@example.invalid> wrote:
> Don't want to start a long-winded discussion, just seeking some
> general views. . .
>
> I was trained in SQL years ago and was encouraged to use lower-case
> letters with words separated for emphasis using the underscore
> character, for example:
>      customer_num, employee_id, invoice_line, transaction_code
Ahh yes. When I started with SQL, working in the IBM QMF (Query
Management Facility), we always used _ as word separators, since the
QMF output would split the words at the _ and produce a nice looking
report.


Andrew C.

unread,
Nov 21, 2009, 1:41:31 AM11/21/09
to

"gargoyle60" <gargo...@example.invalid> wrote in message
news:a4scg518nnpm9vhj5...@4ax.com...

I don't know that I can justify it[1], but I generally use the practice
you're trying to get away from, namely lower-case with underscore-separated
words for MySQL, but letter-case-separated words (so-called 'camelCase') for
pretty much all 'proper' programming languages.

It hasn't tripped me up yet (in fact, as William suggested, I think it's
handy to make an obvious distinction), but that may be just because I'm not
trying hard enough... :-)

A.

[1] In fact, I'm fairly sure I can't! ;-)


gargoyle60

unread,
Nov 22, 2009, 4:12:13 PM11/22/09
to
Thanks to all who reponded.
0 new messages