9
Contributors
10
Replies
66
Views
3 Years
Discussion Span
Last Post by Ancient Dragon
Featured Replies
  • > what do you prefere for naming: database - c++ - java - php? Like they say: "When in Rome, do as Romans do." To me, it's all about whatever is conventionally used in the project or language in question. None is intrinsically better than another, the only thing that … Read More

0

Personally I prefer camel case, username or multipleWordUsername

However, I code in PHP, and it's convention there to use all lowercase variables, with words separated by underscores, such as username or user_id

Personally I think it's ugly.

0

ah, I much prefer everything in capitals rather than lowercase if we're going to use underscores between words.
Anyway, it's not USER_NAME but USERNAME, single word.
USERID or USER_ID, your choice.

0

I use #4 for private properties and local variables, #3 for public properties, constants, table- and column names.

Edited by pritaeas

0

No.2 for me usually for database items - but username not user_name (as mentioned by jwenting). Each to his or her own though. I use camelCase for other things though.

1

what do you prefere for naming: database - c++ - java - php?

Like they say: "When in Rome, do as Romans do."
To me, it's all about whatever is conventionally used in the project or language in question. None is intrinsically better than another, the only thing that makes one notation superior to another is how accustomed the most-likely readers are to it, that's why they're called "conventions". If I program in my C++ library or in Boost, I follow the STL-style custom (lower-case, underscore-separation for most things, except template arguments (and concepts) in CamelCase), because that is the established custom there (and in most "expert" C++ libraries). If I code in Clang (also C++), which makes abusive use of OOP and is heavily influenced by Java and Objective-C, then I write in that Java-style CamelCaseObject.doSomething(); style.

I tend to prefer the C++ STL style because that's what I'm most used to, that's all. I tend to dislike the Java-style CamelCase notation, but that is mostly because I do a lot of C++, and Java-style notation is usually an indicator of Java-style programming, which, in C++, is a guarantee of very poor code quality. So, that's why it's off-putting to me, because I get a bad feeling about what I'm getting into.

0

I much prefer everything in capitals rather than lowercase

Just a note about that - some SQL GUIs automatically capitalize reserved words, so it's a good "heads-up" when you see a fieldname capitalize automatically if you don't use capitals. But, all fields/tables etc should be backticked - but we get lazy :) Perhaps not the best reason for adopting a convention though.

Edited by diafol

0

I agree -- I like to capitalize SQL reserved words and make everything else lower-case or a mixture of upper/lower case. That makes reserved words stand out.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.