Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Naming conventions in .NET?

Naming conventions in .NET?

Scheduled Pinned Locked Moved The Lounge
csharpjavadelphihtmldotnet
27 Posts 17 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Robert Ranck

    The official .NET Framework guidelines are documented in the book "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries". This book includes the guideline to use Pascal case or camel case for acronyms more than two characters, but before getting to that it says, "In general, it is important to avoid using acronyms in identifier names unless they are in common usage and are immediately understandable to anyone who might use the framework." (Section 3.2.1. Capitalizing Acronyms). In an annotation in that same section, co-author Brad Abrams acknowledges that the Framework does not consistently follow these guidelines, and states, "For the most part, our customers have seen the places in which we have diverged from these guidelines (for even the best excuse) as warts in the Framework."

    R Offline
    R Offline
    Robert Ranck
    wrote on last edited by
    #21

    I should have given full credit to the authors and publisher when quoting that book. "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" by Krzysztof Cwalina and Brad Abrams published by Addison-Wesley as part of the Microsoft .NET Development Series

    1 Reply Last reply
    0
    • N Nish Nishant

      ASCII, UTF, API etc are acronyms. You don't want a class called AmericanStandardCodeForInformationInterchangeEncoding do you? Regards, Nish


      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
      The Ultimate Grid - The #1 MFC grid out there!

      G Offline
      G Offline
      geek0735
      wrote on last edited by
      #22

      I hate to be a stickler, but since we're picking at nits: word-objects like "UTF", "RNG", "DSA", etc are not acronyms, they are initialisms. An acronym is technically an initialism where the initials constitute a pronounceable word, like "GUI" or "ASCII". Not that anybody cares... Courtesy of the Ben Hunter school of useless knowledge...

      M 1 Reply Last reply
      0
      • M Mircea Grelus

        Camel case = grouping of word with first letter capitalized. ASCI (American Standard Code for Information Interchange), UTF7 (7-bit Unicode Transformation Format). ASCII and UTF are not names by themselves. I find naming ASCIIEncoding or UTF7Encoding proper. It would be improper to name them asciiEncoding or utf7Encoding. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.

        D Offline
        D Offline
        dr TyGER Konstantin
        wrote on last edited by
        #23

        Completly agree! There is rules, but there is also exception to the rule! UTF7*, ACSI* - is right, becouse it's exceptions...

        1 Reply Last reply
        0
        • M Mircea Grelus

          Camel case = grouping of word with first letter capitalized. ASCI (American Standard Code for Information Interchange), UTF7 (7-bit Unicode Transformation Format). ASCII and UTF are not names by themselves. I find naming ASCIIEncoding or UTF7Encoding proper. It would be improper to name them asciiEncoding or utf7Encoding. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.

          S Offline
          S Offline
          Steven J Jowett
          wrote on last edited by
          #24

          Interesting debate, but unless you plan to distribute your components, classes etc to third-parties, does it really matter? Having said that, I believe that most of us are intelligent enough to work out that ASCIIEncoding and AsciiEncoding are the same thing. Steve Jowett. Wait for my first born to arrive, any day now :-D

          M 1 Reply Last reply
          0
          • S Steven J Jowett

            Interesting debate, but unless you plan to distribute your components, classes etc to third-parties, does it really matter? Having said that, I believe that most of us are intelligent enough to work out that ASCIIEncoding and AsciiEncoding are the same thing. Steve Jowett. Wait for my first born to arrive, any day now :-D

            M Offline
            M Offline
            Mircea Grelus
            wrote on last edited by
            #25

            Of course that the naming convension wouldn't get in the way of doing our job. But it can cause impediments if one project is split among more development groups. When all the parts must be combined it is really a pain in the a** to start renaming classes and namespaces. It could introduce bugs into the project and also it's just stupid wasted time. Of course this doesn't happen that often if the project management is good, but it was just an example. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.

            S 1 Reply Last reply
            0
            • M Mircea Grelus

              Of course that the naming convension wouldn't get in the way of doing our job. But it can cause impediments if one project is split among more development groups. When all the parts must be combined it is really a pain in the a** to start renaming classes and namespaces. It could introduce bugs into the project and also it's just stupid wasted time. Of course this doesn't happen that often if the project management is good, but it was just an example. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.

              S Offline
              S Offline
              Steven J Jowett
              wrote on last edited by
              #26

              I take your point. But what I was trying to say (badly) is if you are coding only for your in house development then you to free to dictate any coding standard you choose. When developing within a group, the coding standards should be agreed by all concerned and implemented accordingly. Having said that, you should also keep in mind that your company my employ other developers after you leave, who may pick up your work. I they do not understand your coding methods and standards then the chances are they'll bin your work and do it again. Most importantly, your code should be easy to follow, and the best test for that is give it to a non-developer and ask them what each section does. Ideally they should be able to tell from the procedure name. Steve Jowett

              1 Reply Last reply
              0
              • G geek0735

                I hate to be a stickler, but since we're picking at nits: word-objects like "UTF", "RNG", "DSA", etc are not acronyms, they are initialisms. An acronym is technically an initialism where the initials constitute a pronounceable word, like "GUI" or "ASCII". Not that anybody cares... Courtesy of the Ben Hunter school of useless knowledge...

                M Offline
                M Offline
                machman1
                wrote on last edited by
                #27

                That wasn't useless my friend! :-D

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups