Thoughts on the power of naming conventions

Ian has some good thoughts on naming conventions.  I'll make sure the folks on the WinFX team hear this load and clear. 

          I like this naming convention because it means that an important fact about the code leaps out at me.

Comments (7)

  1. Andy Smith says:

    Of course, as it is with most things, to much can be bad. In order for this jumping effect to be useful, you have to limit the number of jumpy things. The reason that "I" is so powerful is the exact same reason that it is decried… because it breaks convention and jumps out. If you were to go around giving everything a prefix wart, then all the power of I is lost. poof.

  2. Kevin Daly says:

    I agree entirely with Andy’s comments. The "I" is a special case (especially in C#, where the syntax for inheritance and implementation would have potential for confusion with classes otherwise).

    I don’t ever, ever want to go back to Hungarian notation (in fact I’m still waiting for all authors and writers of articles to get the message) in any shape or form. Apart from being ugly and clumsy, the prefixes in my view tend to overwhelm the meaning of the rest of the name. Because they er, come first.

    Prefixes for UI elements are a different matter, of course (I think). Or should they be suffixes?

    I just have one other question: Why does Visual Studio.NET apply normal instance variable naming conventions to the casing of control names for Windows Forms (e.g. textBox1), whereas for ASP.NET it does not (e.g. TextBox1)? Someone might want to revisit that one in time for Orcas (I should check my Whidbey alpha, but I’m too lazy to start up the VM just now).

  3. moo says:

    I name all my methods and fields from the telephone book. People think im nuts but im just being systematic.

  4. Incidentally, as the author of the article Brad linked to, I’d just like to point out that I agree entirely that you need to limit the number of cues. (In fact that’s exactly what I say in the blog… And I even specifically cite overuse of Hungarian notation as an example of how it can go bad if taken to extremes. 🙂 )

    So yes, I couldn’t agree more – too much is bad!

  5. moo says:

    Welcome to intellisense.

  6. Rene Schrieken says:

    As I’m coaching some of my fellow programmers I find having cues extremely usefull (although I must admit I’m an Hungarian notiation adept) because it gives me intantly all clues about the code without the need to hover or point and press keys on all members to get some usefull info from intellisense.

    On the projects I’m working on a strict naming convetions is in place and enforced by either code reviewing or automated tooling

  7. Ken Brubaker says:

    For my own reference, I thought I’d compile a quick list of design guidelines added by Brad Abrams, et al.

Skip to main content