textBoxEmployeeName vs employeeNameTextBox

后端 未结 16 1023
死守一世寂寞
死守一世寂寞 2020-12-16 00:11

Which naming convention do you use and why?

I like to use employeeNameTextBox, because:

  • It seems more natural from an English language perspective.
16条回答
  •  余生分开走
    2020-12-16 01:05

    As I read it, an article linked to in the article mentioned in the question (namely, Names of Resources) does use the control type at the end, in FileMenu (and ArgumentException though it's not a control).

    My personal opinion is that this is also more readable, as it's the employee name text box and hence should be named the employeeNameTextBox, just like the words "File menu" are read in that order. (Though I substitute "Edit" for "TextBox" for brevity — I should probably kick that habit to use control names consistently with the environment name for them.)

提交回复
热议问题