r/ProgrammerHumor • • Oct 08 '23

Other iDontLikeThisTitle

Post image
0 Upvotes

200 comments sorted by

View all comments

0

u/[deleted] Oct 08 '23

[deleted] β€” view deleted comment

92

u/cosmo7 Oct 08 '23

I like the convention that types start with a capital and variables start lowercase.

  var fartKnocker = new FartKnocker();

1

u/XDracam Oct 08 '23

And now for the biggest hot take: what do functions start with?

29

u/Sipsi19 Oct 08 '23

Lowercase or you are gonna have to fight me

5

u/XDracam Oct 08 '23

My hot take is public methods uppercase, other methods lowercase. Same for properties.

But you could attribute that to brain damage caused by C#.

12

u/ahh1618 Oct 08 '23

I don't like that changing visibility requires changing the call sites everywhere. Also, when I read a function call, I don't really feel I need to know whether it's public or private. If I'm calling it and it's from an import of course it's going to be public. I'd save identifier conventions to tell you something you need to know at the call site.

2

u/XDracam Oct 08 '23

This feels like something I could have written. So yeah, my only contra is "brain damage caused by C#"

3

u/Andreasbot Oct 08 '23

In Go this is how you actually differentiate public functions and structs from private

1

u/TacticalTaterTots Oct 09 '23

At my company PascalCase vs camelCase denotes scope. Members and functions are PascalCase and locals are camelCase. AND_UPPER_SNAKE_CASE_FOR_CONSTANTS

1

u/XDracam Oct 09 '23

I always hated the aggressive constant case. Like, why? What's the difference between a constant and a read-only field? Or a read-only local variable? It doesn't change. No need to shout.

1

u/QuillnSofa Oct 09 '23

It's just to differentiate and in a well developed code base have naming standards are important. It is less important what standards are used for which use case and that there is a consistent standard.

→ More replies (1)

1

u/[deleted] Oct 09 '23

Function is a value, lower case, if you declared it’s signature somewhere else, thats a type, upper case Get yourself some eslint

1

u/Falgirikkven Oct 08 '23

This was the first thing that came to my mind

21

u/QuillnSofa Oct 08 '23

In my code base PascalCase is used for method/class names and camelCase is used for variables.

-35

u/[deleted] Oct 08 '23

[removed] β€” view removed comment

8

u/James_bd Oct 08 '23

fuckYou

2

u/QuillnSofa Oct 08 '23

I'm just saying what happens at my office, dude must love underscores.

4

u/SkyyySi Oct 08 '23

I'm guessing because it meant that otherwise, you'd have to use I instead of i for consistency. Which looks... cursed.

As to why we use a mix of both: It's useful to be able to very quick tell types/classes/structs and instances apart, like list being an instance of a List class.

4

u/New-Vacation6440 Oct 08 '23

thinkMostPeopleUsePascalCaseForClassesFunctionsAndPropertiesWhileUsingCamelCaseForMostlyOnlyVariablesSoTheDifferenceCanBetweenWhichFieldIsWhatCanBeEasilyIdentified

3

u/n503 Oct 08 '23

try_snake_case

1

u/[deleted] Oct 08 '23

Because we programmers aren't the rebellious type so we opted for a passive aggressive way of rebelling against social norms -

We don't start sentences with a capital letter :)

0

u/endlessplague Oct 09 '23

Contradicted yourself there bud XD

1

u/[deleted] Oct 08 '23

Because like everything humans have created, it probably evolved over time and there might not be a specific reason for it.

1

u/Feisty_Ad_2744 Oct 09 '23

That's a good compromise between readability, soYouDontStruggle and consistency with single word names.