CamelCase? snake_case? Something else? And why?

@dengismceo
link
fedilink
101Y

: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 ;)

☆ Yσɠƚԋσʂ ☆
link
fedilink
8
edit-2
1Y

kebab-case-is-just-as-readable, unfortunately not an option in c or python :)

!usernamechecksout

Dessalines
admin
link
fedilink
91Y

Doesn’t matter to me, but I like that rust has built in enforcement of consistent naming conventions for functions, traits, etc.

@nromdotcom
link
fedilink
81Y

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.

Adda
link
fedilink
11Y

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.

@dreeg_ocedam
link
fedilink
4
edit-2
9M

deleted by creator

@t_var_s
link
fedilink
51Y

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.

Kebab case hands down, it’s as readable as snake case, but easier to type. Unfortunately, it’s rarely seen outside Lisps.

Ravn
link
fedilink
51Y

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.

@ksynwa
link
fedilink
21Y

Yeah you’re right it is much easier to type. Wish more languages had this.

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.

@gracelmul
link
fedilink
21Y

Basically what Rust has

@Talkless
link
fedilink
21Y

I use CamelCase::likeQtDoes(), probably just because Qt does so, as 99% work done by using Qt library.

@kaosfang_
link
fedilink
11Y

Probably camelCase is what i use most, but if im working withsome who likes snake_case im fine with that as well

i like any that doesnt involve me hitting - or _ since its really annoying to reach for that key. also visually i like camelCase the most

@Lowey
link
fedilink
11Y

Like_This can’t remember name

@zksmk
link
fedilink
31Y

Cake case (camel+snake=cake).

@glennsl
link
fedilink
5
edit-2
1Y

deleted by creator

@ufrafecy
link
fedilink
2
edit-2
1Y

deleted by creator

@sia
link
fedilink
1
edit-2
1Y

deleted by creator

please tell me you’re joking. how do you even go back to a code you wrote a year earlier?

@sia
link
fedilink
1
edit-2
1Y

deleted by creator

Ravn
link
fedilink
1
edit-2
1Y

deleted by creator

General Programming Discussion
!programming

    A general programming discussion community.

    Rules:

    1. Be civil.

    Other communities:

    • /c/rust
    • /c/python
    • /c/powershell
    • /c/haskell
    • /c/fpcomplete
    • /c/cpp
    • /c/c_programming
    • /c/julia
    • 0 users online
    • 7 users / day
    • 13 users / week
    • 29 users / month
    • 125 users / 6 months
    • 2.9K subscribers
    • 815 Posts
    • 1K Comments
    • Modlog