Skip to content
loading...

re: snake_case, camelCase, or dash-case? VIEW POST

FULL DISCUSSION
 

It varies strongly from language to language.

Java has a de facto styleguide that says variables should be camelCased and classes should be CamelCaps (and other "rules" and conventions - POJO conventions comes to mind).

Python has PEP8 that also has their saying: classes should be CamelCaps and variables, snake_case (both, preferably - exceptions apply).

PEP8 is a interesting reading.

@yujiri8 mentioned JSON has a standard and, AFAIK, there isn't an official one. The JSON.org docs says that properties names should contain only 'a'..'z', 'A'..'Z' and '_'. There's also no indication on ECMA of a standard.

Kebab case is, IMHO, confusing as it would be mistaken for a minus sign (and probably incompatible in some languages).

My take here is: follow the language convention. It's easier on the eyes of people that has more time/experience on the language and less work for the linter (if you use one - PS: you should).

 

In some Python libraries, like PyQt, uses CamelCase (PascalCase).

code of conduct - report abuse