I find that I often disagree slightly in my naming conventions for variables, and I'm just curious about what people consider to be the best. The specific convention I'm talking about is when a variable should be described by a noun and an adjective, and whether the adjective should precede or after a noun. The question is common in all programming languages, although I personally use C ++ and Python.
For example, consider writing a graphical interface that has two buttons; one on the right, one on the left. Now I have to create two variables to store them. One option would be to have an adjective in front of a noun and call them left_button and right_button . Another option would be to have an adjective after the noun and call them button_left and button_right . In the first case, this makes sense when reading aloud, because in English you always put the adjective before the noun. However, with the second case, it helps to structure the data semantically, because button shows the most information about this variable, and left or right - additional information.
And what do you think? Should an adjective come before or after a noun? Or is it completely subjective?
source share