←back to thread

German Naming Convention

(chrisdone.com)
46 points thunderbong | 1 comments | | HN request time: 0s | source
Show context
saulpw ◴[] No.42185045[source]
Code golf variable names are intolerable. But there's a happy medium. If you name all your variables like "Rechtsschutzversicherungsgesellschaften", note that I am still a violent psychopath and I know where you live.
replies(2): >>42186461 #>>42188891 #
lifestyleguru ◴[] No.42186461[source]
Just think of German as a bimodal language. The first is a language with cases, pronouns, word order. Thesecondissimplyyoudisregardspacesandstickthewordstogether. Both are perfectly valid and expected while dealing with this language. As you mentioned insurances... they like them as well a lot, anything overlapping both legal and insurance domains is a true climax.
replies(1): >>42187656 #
saulpw ◴[] No.42187656[source]
That's fine for German, but in source code I don't want any variable called LegalProtectionInsuranceCompanies. It takes up too much brain space for me to parse and understand each time. Much rather it was called "lpic" with a comment expanding it at time of definition.

Class names are a separate discussion.

replies(1): >>42198614 #
nuancebydefault ◴[] No.42198614[source]
Indeed.

The problem with long var names is that formulas become unreadable and function names take away horizontal real estate for their args.

There are so many ways out to make it shorter yet readable.

- idx is often used as index.

- An event handler can start with On.

- Simply take the first 3 or 4 letters of every word. simpToReadVar

- keyISR Keyboard Interrupt Service Routine

- fName file name

replies(1): >>42200998 #
soonnow ◴[] No.42200998[source]
I just want to point out you are saving 3 characters on the last one while making it a fair bit harder to understand. fileName is perfectly fine. fName could be firstName, fileName, finalName, foundName...
replies(2): >>42206774 #>>42210470 #
1. nuancebydefault ◴[] No.42206774[source]
You are right!