Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use lowercase-with-hyphens for CSS identifiers.

Would you suggest using all three naming conventions where appropriate, or picking one and using it, even if the other two recommend something else? Switching back and forth isn't a huge problem, but it can still be mental overhead.

share|improve this question

Use the right one for the language. It helps others when they are maintaining the application, and it helps you context switch between languages quicker as the language you are currently working in looks as it should.

share|improve this answer
Not to mention that most likely, you'll have to deal with libraries that probably use the established naming conventions of their respective language community. – tdammers Nov 17 '11 at 20:07

It depends on the conventions of the company, team, or project. There is no right answer, other than to do what the code style guides say. If you are on a multi-langauage project, then the guidelines should specify a language-independent style or what style to follow when writing code in each language.

Personally, I would prefer the style recommended by the language. It's much more natural when interfacing with external libraries written in that language and would be easier to read. However, any existing style conventions on the project should be obeyed first.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.