0

I found out this article I would like share with you.

http://10rem.net/articles/net-naming-conventions-and-programming-standards---best-practices

Naming convention for controls

Regarding name conventions for "Controls on Forms", I thought to use this:

ux-Description-GeneralType

Example:

uxUserIdInput

PRO:

  1. have IntelliSense group all my Controls
  2. possibility to identifu the type in IntelliSense
  3. If I change the Type I do not need to update my code

Because I am pretty new at developing, I would like start with the right foot and using solid practices.

Do you guys agree with that. Would you advice some other name convention?

Thanks for your time! bye

Community
  • 1
  • 1
GibboK
  • 71,848
  • 143
  • 435
  • 658
  • note that suffix is a general type in a sense that it will indicate type in functional sense (e.g. Index, Field, Label, Container) and not actual code type. So you should not be in situation #3 where changing (code) type will force you to change the name. – VinayC Sep 08 '10 at 09:57

2 Answers2

1

As long as your convention is documented and followed by all members of the team, it is fine whatever the convention. Define your conventions once, stick to it for the lifetime of a project. If you need to change the convention, change it for the next project.

Keep in mind though that Microsoft recommends to remove this kind of prefixes from the variable names. As such, FxCop would complain (unless told to ignore this rule).

Johann Blais
  • 9,389
  • 6
  • 45
  • 65
0

Your conventions are fine, especially as they do not deviate from the rest of .NET.

What matters the most (as already written on the SO reference) is consistency.

Timores
  • 14,439
  • 3
  • 46
  • 46
  • 1
    Honestly, I spent hours with various people that tried to convince me that "their" idea of a naming convention was the only acceptable one that I now have a very detached view of this issue. – Timores Sep 08 '10 at 09:49