On Aug 11, 2006, at 6:00 PM, James Harvard wrote:

FWIW a couple of weeks ago I read of a good reason not to use uppercase letters in table column names. I can't remember what it was now, but it seemed like sense at the time! My personal preference is to always use lowercase and separate any words that need it with an underscore. Apart from that I agree with Douglas Sims that what is most readable is best.

select user_email, user_address, user_postcode from users where user_id = %d;
# Hmm

Not so readable, I agree, but great when you want to find all references to a particular database column in 1000s of lines of code!

I have found this more important than readability (although there is no excuse for sloppy formating).

select email, address, postcode from users where user_id = %d;
# Less typing and more readable.

In fact I would go a step further. Call the table tab_users (or something similar), so that it is easy to find all references to this particular object in your program.

Also make sure structure and class members have unique names (prefix the names with a short form of the structure name). For example, think of how many fields are called 'flags' in a C program. It is extremely useful to be able to quickly find all references to a particular flags field.

This also makes a program for outsiders easier to understand because it is possible to answer questions like "How is this field/column used?", but just doing a global search.

- Paul


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to