CamelCase? snake_case? Something else? And why?
:snake: SNAKE_CASE_GANG :snake:
it has the best readability. and i spend most of my time in c or python. and i hate hitting shift ;)
kebab-case-is-just-as-readable, unfortunately not an option in c or python :)
deleted by creator
Doesn’t matter to me, but I like that rust has built in enforcement of consistent naming conventions for functions, traits, etc.
I like whatever the accepted standard is for the language I’m using at the time.
So for python and ruby we’re talking snake_case variables and PascalCase classes, for javascript camelCase variables and PascalCase constructors, for go camelCase for unexported and PascalCase for exported.
Don’t really see how one might have a personal favorite that they apply to all languages equally.
Yeah, the best is when a language already has a standard formatting and that is used by every library. Good examples are Go and Rust which have an “official” formatting tool that is developed. So you can just stick to it and not think about it.
Consistency is the most important part, the rest matters a lot less.
Exactly this. I have lacked this comment here and was surprised no one has mentioned it earlier. One might prefer one format over the other, whenever there is a standard though, one should immediately switch to it and stick with the standard for the given language. Not what the discussion asked for though, so that might be the reason.
snake_case for variable names because they seem to be holding something in their underscores. camelCase for functions because verbNoun looks good. PascalCase for classes because it looks like it’s a level above that needs to be instantiated before getting used.
I think dashed-case is superior in just about every way, but unfortunately only supported in very few languages. Of those supported in most programming languages I find snake_case to be most readable. A little bit awkward to type, but I think that trade-off is more than wroth it.
It really doesn’t matter all that much as long as it’s consistently applied across the ecosystem though.
My primary programming language has been Python since 2008, so the answer is obvious. Though I like consistency even more, so CamelCase is also ok when used everywhere.
Basically what Rust has
It depends on the context but I like Python’s recommendations, particularly the part for modules
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
Recently I’ve been diving into composing functions and long camel case descriptive names which I would normally dislike actually seem to work pretty well.
snake_case and kebab-case
Kebab case hands down, it’s as readable as snake case, but easier to type. Unfortunately, it’s rarely seen outside Lisps.
Also looks neater and more streamlined. I find snake case gives the feeling of everything being a bit imbalanced with all those underscores weighing everything down.
Yeah you’re right it is much easier to type. Wish more languages had this.
I use CamelCase::likeQtDoes(), probably just because Qt does so, as 99% work done by using Qt library.
deleted by creator
I really like kebab-case, because I’m a lisp aficionado
Lowercase with less than 8 characters. All my variables have names like vbl or sxv or vd.
please tell me you’re joking. how do you even go back to a code you wrote a year earlier?
I write superb documentation.
Like_This can’t remember name
Cake case (camel+snake=cake).