4 ms·
> Meanwhile it's the small things everyone can do. One thing I advocate for is to adopt the most common style for identifiers in Java, Javascript, Typescript, P
by JodieBenitez 3y ago
> Meanwhile it's the small things everyone can do. One thing I advocate for is to adopt the most common style for identifiers in Java, Javascript, Typescript, Python, and even some parts of the C/C++ world and do away with snake_case.
snake_case is used a lot in Python:
module_name, package_name, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name.
(not mandatory, it's just from the style guide)
But I don't even think snake_case or CamelCase matter as much as plain keywords vs. symbols or "commonly used" symbols and ones that are not too noisy.
I know compared to Rust strong points this all seems to be petty criticism, but we all read lots of code, probably more so than writing.
- weinzierl 3y agoI'm OK with SCREAMING_SNAKE_CASE for constants, because that is an ubiquitous convention. Same for globals, they should be rare anyways (and constant most of the times). For crates dashes are already widely used and that is how it should be. +1 for plain keywords. Common separators when necessary (e.g. constants or everything that ends up in the filesystem, bc upper/lowercase is a pain there). Regular struct, enum, trait variable names: CamelCase hands down, like almost everyone does it.
- insanitybit 3y agoVariable names in most languages are pascalCase, not CamelCase, which is typically used for type names.