My convention is pretty specific:
Class: title case
Person, HumanBeing
Variables: camel case + ( ( underscore + TitleCase ) * x )
item_Property_SubProperty, name, firstName, firstName_Vowel_Count
Functions: same as variables, but with a verb as the first word
verb_Description, get_FirstName
I only use camel case initially to differentiate between classes and [ variables | functions ], but find that title case offers the ability to minimize underscores while maintaining readability and also more clarity than strict camel case.
EG:
lastWord_FirstSegment_Vowel_Count
vs lastWordFirstSegmentVowelCount
vs lastword_firstsegment_vowel_count
vs last_word_first_segment_vowel_count
Although I will agree that this is my own take on “what is readable or not”, as you mentioned.
PEP8 shows mixed LISP
and K&R
style @ Indentation.
True. I guess for in-line context, whitespace maybe detracts from code relationships. I write more for macro-level scanning so I can find what I’m looking for quickly, and then utilize ST’s native bracket highlighting if I need to precisely interpret a particular line. Also, I tend to over-declare variables as to avoid that issue entirely, so I can read complex nestings as if they were text rather than having to decipher functions in-line.
EG: I spread my rocks out so I can find them easily, and if I need to inspect one I’ll pick it up & stare at it.
Meh, I feel like it’s unavoidable since there are so many languages ( some of which have particular convention limitations ), potential styles, and personal preferences.
I know I’m not always going to dig everyone’s code preferences, but I can always use a tool to format their code or run a RegEx replace or something. If I’m contributing to a repo I just try to adapt & use it as an exercise in versatility.
Have you used CoolFormat by any chance? I find it super useful for quickly altering code that’s not in my preferred format. Just wish it had a few more language options… Know of any similar options that may be more universal?
Also, out of curiosity since you mentioned you review a lot of code - what kind of stuff do you work on outside of ST?