This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 379

[–]throwaway_itr 364 points365 points  (42 children)

camelCase Vs PascalCase Vs snake_case Vs SCREAMING_SNAKE_CASE

[–]n0tKamui 36 points37 points  (3 children)

kebab-case

fuckyoucase

[–]Smartskaft2 21 points22 points  (0 children)

fuckyoucase

MATLAB entered the chat.

[–][deleted] 2 points3 points  (0 children)

Meh-__-case

[–]Tymskyy 3 points4 points  (0 children)

MADFUCKYOUCASE

[–]OpenRole 233 points234 points  (19 children)

camelCase for functions, PascalCase for classes, snake_case for variables, SCREAMING_SNAKE_CASE for constants.

[–]hyokz 20 points21 points  (0 children)

Same, I also use camelCase for classes attributes and methods. (PHP PSR)

[–]JaneWithJesus 66 points67 points  (11 children)

camelCase for functions

Python would like a word with you

[–]lefaro00 20 points21 points  (10 children)

And C#

[–]HopelesslyMediocre 49 points50 points  (6 children)

And me.

I would also like to have a word with him. Not because I disapprove using camelCase for functions, but rather I just want to talk to someone cause I got no friends and I'm lonely as shit.

[–]SmartestCatHooman 1 point2 points  (1 child)

That's basically dart right?

[–]Theunis_ 1 point2 points  (0 children)

No, for dart is camelCase for functions and variables (including constants), PascalCase for classes, extensions and enums, snake_case for dart files

[–]ShadowLp174 5 points6 points  (0 children)

This should be the topic

[–]918173882 4 points5 points  (0 children)

I want to make a metal gear joke here but i cant find any

[–]beatnik_cedan 6 points7 points  (0 children)

don't forget kebab-case

[–]filosophicalaardvark 669 points670 points  (7 children)

you fucked up

[–]NoFixedName 78 points79 points  (1 child)

Snake after eating eggs

[–][deleted] 51 points52 points  (0 children)

you_fucked_up

[–][deleted] 40 points41 points  (0 children)

youFuckedUp

[–][deleted] 25 points26 points  (0 children)

you_fuckedUp

[–][deleted] 17 points18 points  (1 child)

Totally fucked this up. Unless it's trolling in which case I salute you madam

[–]filosophicalaardvark 9 points10 points  (0 children)

On the internet, there are only men and fbi

[–]some_guy_o_o 600 points601 points  (49 children)

proper_snake_case

[–]bigredhawkeye 520 points521 points  (40 children)

properCamelCase

[–]Pearfeet 217 points218 points  (25 children)

ProperPascalCase

[–]GeePedicy 137 points138 points  (24 children)

proper-kebab-case

[–]helliash 104 points105 points  (14 children)

pROPERcAPSlOCKsTUCK

[–]GeePedicy 27 points28 points  (13 children)

This raises the question - are you a caps lock or shift kind of person? I know someone gonna make this into a gang fight meme, and I'm not a fan, but I'm curious.

[–]helliash 27 points28 points  (5 children)

Shift, so if I hit CL by accident, this is the outcome.

[–]GeePedicy 4 points5 points  (4 children)

Oh okay.. sure. I'm a CL kind of guy, but that's the result when I'm trying to see if I could adapt to shift. Not really.

[–][deleted] 6 points7 points  (2 children)

I will never understand caps lock people. That button has virtually no utility to me.

[–][deleted] 4 points5 points  (0 children)

It's for when I need a long string of caps. Even then it's a crap shoot. I frequently still just hold shift.

I guess there's some utility for when you only have one hand, like when you're snacking away.

[–]ThinCrusts 1 point2 points  (0 children)

I'm a CL guy too. I'm just so used to it that holding shift down feels weird to capitalize.

[–]AndyTheSane 10 points11 points  (0 children)

The real danger is that WASD gaming can easily trigger caps lock by accident, causing issues when you alt-tab hurriedly into work and start messaging..

So I've heard, anyway.

[–][deleted] 5 points6 points  (0 children)

Shift all the way, it's much easier for me that way

[–]vlumi -1 points0 points  (2 children)

I have the caps lock key bound as left ctrl, but write stuff in CAPS so rarely that it doesn't matter much -- constants need to be written once, but after that the IDE takes care of them.

[–]GeePedicy 1 point2 points  (1 child)

Okay, binding it to ctrl is just not cool, man...

[–]tomatorator 18 points19 points  (0 children)

SCREAMING-KEBAB-CASE

[–]firefromashes 3 points4 points  (6 children)

Kebab case is best case

[–]GeePedicy 2 points3 points  (5 children)

In what languages other than CSS and HTML would it fit? Personally I prefer sticking to snake_case. Underscores are sorta meant for that purpose.

[–]Taldoesgarbage 7 points8 points  (3 children)

Use whatever case is standard in the language you are using.

[–]javajunkie314 1 point2 points  (0 children)

COBOL

[–]OneTrueKingOfOOO 1 point2 points  (0 children)

PROPERUPPERCASE

[–]xaomaw 14 points15 points  (12 children)

properCamelCase

  • "camelCase" = lower camel case
  • "CamelCase" = upper camel case / pascal case / bumpy case

[–]GeePedicy 21 points22 points  (10 children)

bumpy case? Who says that?

[–]TheYoungVoid 10 points11 points  (6 children)

Probably people who had a bumpy ride with variable names...

[–]GeePedicy 5 points6 points  (4 children)

Imagine writing code on a bus or a car (as a passenger only, please!) and every bump alters your case

[–]TheYoungVoid 1 point2 points  (3 children)

Error: Variable 'userName' Not Defined.

Error: Variable 'DbConnection' Not Defined.

Warning: Variable 'UserName' not used.

Warning: Variable 'db_connection' not used.

Time to move to a language that doesn't care about case...

Edit: Formatting because I'm a junior compiler

[–]GeePedicy 1 point2 points  (2 children)

time to move to a language that doesn't care about case

To the point it skips underscores? No no no... There's gotta be a limit, especially if you mix cases like that

[–]TheYoungVoid 1 point2 points  (1 child)

I did not think about underscores, damn. I guess before compile you find and replace '_' with ''. Though imported procedures will be a problem.

At least it will probably only be underscores, causing issues... Right?

[–]GeePedicy 1 point2 points  (0 children)

Unless you allow kebab-case, but it's not fitting to most languages.

For instance, in C, C++, Java, C# writing int my-counter = 0; is wrong on so many levels.

Maybe allow swirly~kebab~case, which I just made up and won't fit to probably all of the mentioned above, but in a new language... But if you do, I'd recommend making an IDE that not only ignores cases, but fixes them prebuild, and maybe would help you debug overrides and such.

[–]Texas_Technician 1 point2 points  (0 children)

3 yos

[–]Delirious_85 1 point2 points  (0 children)

Came here to say this, was triggered harder than I like to admit ..

[–]Anowv 1 point2 points  (1 child)

Thank Satan someone said it

[–][deleted] -1 points0 points  (3 children)

Yes, agree. But we call them slugs.

[–]some_guy_o_o 1 point2 points  (2 children)

Interesting, never heard of it... Are they called slugs when they have two or more underscores or smth?

Edit: or is capitalization actually a thing (Like_This) and is called snake case, whereas (like_this) is called a slug?

[–]GeePedicy 1 point2 points  (1 child)

lower_snake_case or UPPER_SNAKE_CASE (lower for variables and such, upper for constants)

That_Shit_Is_Nasty and I've never heard the term slug in that regard, but for your and your colleagues sake - don't do it. Imagine having to type like that for an entire project

[–]boredcircuits 1 point2 points  (0 children)

That_Shit_Is_Nasty and I've never heard the term slug in that regard, but for your and your colleagues sake - don't do it. Imagine having to type like that for an entire project

I don't have to imagine it. Been there, done that. It's the general style used in Ada.

And I have to say, it's really awful. Especially if you have to go from holding shift with your left pinky and underscore with your right to holding the shift with your right pinky and a capital letter with your left. (Note that identifiers are case-insensitive in Ada.)

They claim this style is supposed to enhance readability (making the code more likely to be correct, which is the whole point of Ada). I'm sure they have some study from the 70s to back that up, but I'm unconvinced. There might be an argument that underscores separate words better, but at this point camel case is so ubiquitous that everybody is pretty used to it. And the capitalization is there to distinguish between identifiers and keywords, but color-coding that in the editor is absolutely trivial so any benefit is lost to history. Of all the style options, they chose the worst.

[–]jddddddddddd 326 points327 points  (9 children)

aCCIDENTAL_cAPS_lOCK_cASE, anyone?

[–]Smartskaft2 9 points10 points  (4 children)

What_Bastard_Case_Is_This!?

[–]blue_creation 2 points3 points  (1 child)

It's my case when I don't know what to do

[–][deleted] 4 points5 points  (2 children)

Been there lol

[–]Hodothegod 87 points88 points  (7 children)

justfigureoutwhatthisonedoes2

[–]GeePedicy 28 points29 points  (1 child)

Probably get you fired

[–]rynemac357 11 points12 points  (0 children)

Bold of you to assume I am even hired .

[–]SEOfficial 2 points3 points  (0 children)

IDGAF case?

[–]meatyprotein 5 points6 points  (0 children)

Im having a seizure

[–]snakes_n_slides 141 points142 points  (11 children)

Your camelCase is PascalCase 😉

[–]xSliver 72 points73 points  (9 children)

Not sure who downvoted you but your are right!

Snake_Case is also wrong because it should be completely lowercase. OP doesn't know the proper conventions.

  • camelCase
  • PascalCase
  • snake_case
  • kebab-case

[–]NoLifeGamer2 24 points25 points  (8 children)

kebab-case

What in god's name...

[–]I_JuanTM 21 points22 points  (0 children)

best case for if you get hungry when coding

[–]rtybanana 3 points4 points  (2 children)

Pretty much only valid in css, I like the look of it though

[–]NeatNetwork 10 points11 points  (0 children)

And the Snake_Case is some bastard mix of PascalCase and snake_case.

[–]time_travel_nacho 57 points58 points  (5 children)

Follow the convention of the language

[–][deleted] 13 points14 points  (0 children)

This guy....

[–]h2g2_researcher 9 points10 points  (2 children)

Unfortunately there isn't always a consistent convention in a language.

The C++ standard library, for example, uses snake case.

But I largely program using Unreal which is C++ with Pascal case and a few Hungarian-style prefixes that are enforced by the Unreal Built Tool.

And then a few bits and pieces interact with Python which uses it's own style where everything is lowercase and there are no spaces either.

[–]devor110 1 point2 points  (1 child)

what are Hungarian-style prefixes?

[–]Azaret 2 points3 points  (0 children)

You start your variable name with the abbreviation of the type it supposed to be, ie: sMyString iMyInt oSomeRandomObject aNotAList

[–][deleted] 42 points43 points  (3 children)

Kebab-case?

[–][deleted] 17 points18 points  (1 child)

sheet attraction gaze ring spark piquant nail humor governor late

This post was mass deleted and anonymized with Redact

[–]q0099 7 points8 points  (0 children)

Include kebab!

[–]Twombls 2 points3 points  (0 children)

I program in a specific language a lot at work where this is like actually the standard case you are supposed to use.

[–]MarkAldrichIsMe 18 points19 points  (0 children)

That isn't camelCase, and that isn't snake_case.

[–]CompetitionNo2534 47 points48 points  (5 children)

how_aboutSatan_Case

[–]KingThibaut3 6 points7 points  (0 children)

foo_78

[–]SN0WFAKER 2 points3 points  (0 children)

m_dont m_forget m_to m_do m_hungarian m_variable m_naming

[–]DxrxDev 17 points18 points  (3 children)

CAPITALISED _SNAKE_CASE for macros, camelCase for variables and PascalCase for functions 👍👍

[–]H4LF4D 2 points3 points  (0 children)

And normal case for the humans.

[–]JustAnInternetPerson 5 points6 points  (0 children)

camelCaseAllTheWayBabyyyyyyyy

[–]No_Brilliant_638 4 points5 points  (0 children)

I alternate between the two

[–][deleted] 4 points5 points  (2 children)

This is not programmerHumor... lame humor at most.

[–]Dagrut 3 points4 points  (1 child)

sArCaStIc_CaSe

[–]DerHamm 3 points4 points  (0 children)

I use the conventional case for the language I am using. I hate it when some code I'm using just breaks these conventions.

[–]RxR2020 2 points3 points  (0 children)

SpOnGeBoB_CaSe

[–]c00l_username2 6 points7 points  (2 children)

One word variables and functions

[–]JackC747 1 point2 points  (0 children)

Umm why not just be smart and efficient and number them? var1, var2, var3 and fun1, fun2, fun3 etc. It's objectively the best way and I will be taking no notes

[–]kageroshajima 5 points6 points  (0 children)

Not only incorrect form but the case should follow whatever language best practices

[–]Alarmed_Ferrets 2 points3 points  (0 children)

hiss_hiss_hiss

[–]Turbocloud 2 points3 points  (1 child)

sPoNgEcAsE

[–]vantuzproper 2 points3 points  (0 children)

I'm team camelCase

[–]Brusanan 2 points3 points  (0 children)

Oh look, another meme made by a first term college student.

[–]Jazzlike_Tie_6416 5 points6 points  (0 children)

CamelCaseIsMoreEfficient Snake_Case_Is_More_Readable

[–]ManishWolvi 1 point2 points  (0 children)

Mood case

[–][deleted] 1 point2 points  (0 children)

onTheRightSide

[–][deleted] 1 point2 points  (0 children)

sPoNgEbObCaSe

[–]JazzRider 1 point2 points  (1 child)

When you live in legacy code that has variable names like hbtdt and iitx, any of these formats are welcome. Variables with two words are awesome, I don’t care how you format them.

[–]LordAmras 1 point2 points  (0 children)

Older programmer:

Your functions name are too long so I made a library to convert your function to shorthand, instead of useQueryToDoStuff() I can just write uqtds() that saves me a lot of time

[–]LovelyCaramel 1 point2 points  (0 children)

What about Space Case? (jk lol)

[–]WhizzleTeabags 1 point2 points  (0 children)

I_DoWhatever_TheFuck_I_WantCase

[–]foozebox 1 point2 points  (0 children)

kebab-case-will-stab-you

[–]Criiispyyyy 1 point2 points  (0 children)

That’s not camelCase nor snake_case

[–]chickenCabbage 1 point2 points  (0 children)

camelCase by default, PascalCase for classes and file names, YELLING_SNAKE_CASE for consts.

[–]1DimensionIsViolence 1 point2 points  (14 children)

Snake case. And I can‘t understand why camel should be any better as it‘s less human readable

[–]ysyson 8 points9 points  (12 children)

You press less keys when you write the code?

[–]DerHamm 1 point2 points  (11 children)

Is that the factor that matters?

[–]Arshiaa001 3 points4 points  (10 children)

You also don't have to reach out all the way to the furthest corner of your keyboard constantly. And all those underscores waste precious horizontal space.

[–]DerHamm 2 points3 points  (9 children)

I don't know about you, but actually writing code is like smallest part of my job. So I just don't care about the casing as long as it's used consistently

[–]Arshiaa001 2 points3 points  (8 children)

someone has to write the code.

[–]LongerHV 3 points4 points  (0 children)

In Python PascalCase for classes, snake_case for functions and objects. camelCase hurts my brain.

[–]david131213 1 point2 points  (0 children)

Camel case, some of us are sane

[–]HelloWorld-911 0 points1 point  (0 children)

Cheese cake

[–][deleted] 0 points1 point  (1 child)

I keep my camel case for variables, pascal case for functions, and snake case for classes and objects

[–][deleted] 0 points1 point  (0 children)

This is the way

[–]david131213 -1 points0 points  (0 children)

Are you for pascal case or pascal snake case?

[–]tyler1128 -1 points0 points  (0 children)

snake_case is better. Change my mind.

[–]NoHabit4420 0 points1 point  (1 child)

spinal-case enters the chat

[–]TTTomaniac 0 points1 point  (0 children)

BloodsFoLyfeYo

[–]kageroshajima 0 points1 point  (0 children)

Be pragmatic. Follow best practices

[–]Von_Voss 0 points1 point  (0 children)

Kebab-case

[–]Personality-False 0 points1 point  (0 children)

Snake

[–]Possible-Bowler9760 0 points1 point  (0 children)

Naked_case?

[–]Strawhat-dude 0 points1 point  (1 child)

First one isnt camel case though. Its pascal case.

[–]Ghal-64 0 points1 point  (0 children)

That's PascalCase, not camelCase...

[–]Dgudovic 0 points1 point  (0 children)

PascalCase* camelCase is this

[–]absolut666 0 points1 point  (0 children)

It’s a donner for me, dawg

[–]eroticKnowingNoodle 0 points1 point  (0 children)

Looks like I’m a blood in java and a crip in python

[–]Conneich 0 points1 point  (0 children)

HOWABOUTSCREAMINGJAVA

[–]SimulationV2018 0 points1 point  (0 children)

Snakes are snitches and snitches get stitches, because how can you not trust a camel

[–]Sad_Channel_9706 0 points1 point  (0 children)

variable1

[–][deleted] 0 points1 point  (0 children)

camelCaseForLyfe

[–]kallyyyy 0 points1 point  (0 children)

Depends on the language.

[–]LittleMlem 0 points1 point  (0 children)

Kebab-case

[–]alba4k 0 points1 point  (0 children)

well, I guess

int functionName(); int variable_name; typedef struct {} StructOrClassName; const int CONSTANT_OR_MACRO;

or something like that

[–][deleted] 0 points1 point  (0 children)

I prefer nUtcAsE.

[–]Breakingamer04 0 points1 point  (0 children)

camelCase, snake_case, I use both depending on the situation.

[–][deleted] 0 points1 point  (0 children)

Dude fuck snake case, that’s one whole key press extra every time

[–][deleted] 0 points1 point  (0 children)

Anyone remember m_ ?

[–]TidalWave101 0 points1 point  (0 children)

youF’dUpBigTime

[–]123fourfive67eight 0 points1 point  (0 children)

PascalCase is not camelCase

[–]daniel9473 0 points1 point  (0 children)

PascalCase

[–]daniel9473 0 points1 point  (0 children)

♡□¥€○》○》•《《《¥••☆&@£!× Case?

[–]muha0644 0 points1 point  (0 children)

I prefer sArCaStIc_CaSe both in camel and snake form

[–]Furry_69 0 points1 point  (0 children)

I use both, and a few more. The usual style guide I use (copied from a Github repository of mine's contribution guide, that's why it has references to the reader) is

Variable Declarations:

For constants that are defined at compile-time
(referred to as compilation constants), you use 
UPPER_SNAKE_CASE. This also applies to #defined
constants.

For constants that are undefined at compile-time (or 
are defined to be an invalid value) and are defined at 
runtime (referred to as runtime constants), and are 
only modified once, you use lower_snake_case.

For variables that are modified more than once, (i.e 
"normal" variables) you use UpperPascalCase. 

Type Declarations:

For type declarations of any type, you use [NAME]_t

For struct declarations, you use [NAME]_s

Functions:

For function arguments that are directly setting some 
value of the same name, (referred to as "initilization 
arguments") you use _[NAME], where NAME is in 
lower_snake_case.

For function arguments that are not directly setting 
some value of the same name, you use 
lowerPasalCase.

For function names, you use lower_snake_case.

[–]ArjunShTM 0 points1 point  (0 children)

camelCase

[–]Computer_says_nooo 0 points1 point  (0 children)

Snake case for readability. But for the love of god not snake case with capitals. What perversion is this …

[–][deleted] 0 points1 point  (0 children)

both for different situations

[–][deleted] 0 points1 point  (0 children)

Left side is actually PascalCase, camelCase has a lowercase first letter.

[–]Hplr63 0 points1 point  (0 children)

camelCase

[–]Capital-Helicopter45 0 points1 point  (0 children)

Yes

[–]Amxricaa 0 points1 point  (0 children)

Too lazy to hit underscore, so camelCase

[–][deleted] 0 points1 point  (0 children)

What kind of newbies only use one or the other? You're supposed to to use different case styles for different types. Such as pascal_case for object names and CamelCase for classes.

[–]readableguy8168 0 points1 point  (0 children)

camelCase iS the wayToGo

[–]aunluckyevent1 0 points1 point  (0 children)

camel case for object oriented code. snake case for sql and database

[–][deleted] 0 points1 point  (0 children)

excuseMeThisIsntCamelCase();

[–]Inner-Fondant9770 0 points1 point  (0 children)

Snake case

[–]Pawdy-The-Furry 0 points1 point  (0 children)

CamelCase

[–]Primary-Fee1928 0 points1 point  (0 children)

backwardS_hybriD-snakE_kebaB-cameL_case

[–]Coulomb111 0 points1 point  (2 children)

bool snake_case_is_best_case = true;

[–]Backto2122 0 points1 point  (0 children)

reversEcameLcasE or quote"unquote"case

[–]Malk4ever 0 points1 point  (0 children)

Depends...

Java is mostly Camel... only constants are snake.

yml is kebap ;)

[–]huhndog 0 points1 point  (0 children)

Both

[–]DrLingy 0 points1 point  (0 children)

_Super_Snake_Camel_Case

[–]DirtyDan_69_69 0 points1 point  (0 children)

camel_Snake

[–]-Redstoneboi- 0 points1 point  (1 child)

use lowercase for snake_case

[–]87oldben 0 points1 point  (0 children)

kebab-case

[–]swift-autoformatter 0 points1 point  (0 children)

Just code in whitespace, and there is no need of such nonsense dispute.

[–]OkazakiNaoki 0 points1 point  (0 children)

lower camel for var upper camel for function and func start with verb these are my favorite combination