If I want to write a phrase like "Column 1" in snake case (the usual C way of formatting identifiers that looks like some_function
), do I insert underscore between a word or a number, like column_1
, or not, like column1
?
That may be a painfully trivial question, but I haven't been able to find a snake case definition that would answer this.
I have only ever encountered specific documentation on this topic in one place - the Rubocop Ruby Style Guide (https://github.com/rubocop-hq/ruby-style-guide#snake-case-symbols-methods-vars-with-numbers)
It's probably safe to say there is not a clear winner in one approach over the other. One could also argue that the premise of the format is that: for a given string, all letters are lowercase and all spaces become underscores. By that standard you wouldn't format something column1
unless it started out as Column1.
Personally I prefer column_1
approach.
I find it easier to read, and easier to execute batch find/replace regex queries or to make multi-line edits in my text editor.