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.

2 Answers 2


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.

  • 1
    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, 2011 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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