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. What do you think?

What do you think?

Scheduled Pinned Locked Moved The Lounge
questiondatabasesql-servercomsysadmin
94 Posts 67 Posters 1 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 Rocky Moore

    Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

    Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

    J Offline
    J Offline
    jiuli
    wrote on last edited by
    #84

    Maybe it's an annoying thing to review the codes which are full of the underscores. But it derived from the C and assembly languages, unfortunatelly, our senior leader came from this era, just to ingratiate ourself with the manager. So we must write the codes like this. :-D:-D:-D:-D

    R 1 Reply Last reply
    0
    • J jiuli

      Maybe it's an annoying thing to review the codes which are full of the underscores. But it derived from the C and assembly languages, unfortunatelly, our senior leader came from this era, just to ingratiate ourself with the manager. So we must write the codes like this. :-D:-D:-D:-D

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #85

      Well, I am from that same era and had enough of them more than a decade ago :) It is important though to code by the standards of a company where you work or in the lack of a standard being implemented, by the standards used in the large majority of work (which sometimes is not excatly fun ;) )

      Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Ready for Internet TV?

      1 Reply Last reply
      0
      • A Aaron VanWieren

        Can't stand _them. Sorry to butt in on this, but this is one thing I truly hate. Isn't this part of or all of the Hungarian notation? Which has historical roots in early programming?

        M Offline
        M Offline
        meeyak
        wrote on last edited by
        #86

        I like _em! I find it convenient to have all of the private members listed together in the intellisense.

        carpe diem

        1 Reply Last reply
        0
        • R Rocky Moore

          Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

          Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

          E Offline
          E Offline
          EmergentComprehension
          wrote on last edited by
          #87

          One take on this question could be "m_" vs "_". Either is good as they distinguish the scope/lifetime at a glance. Some people express a loathing for "m_", as its old hat. C++ & vb6 typically used some m_ or mvar or similar prefix. I was happy with that. Why change it? The point that many raised is either prefix is fine, so long as its consistent? So why oh why did it have to change?

          1 Reply Last reply
          0
          • R Rocky Moore

            Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

            Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

            E Offline
            E Offline
            eRRaTuM
            wrote on last edited by
            #88

            I for sure agree since the battle {_var vs LocalVariable} is always won, personnaly, by LocalVariable, which is more expressive and less ugly :laugh: :cool: Regards :cool:

            :: YOU make history ::

            1 Reply Last reply
            0
            • J Jon W

              I Like them! :rose: Why? I'm a VB.NET developer... to write none language dependent code is like coding to interfaces instead of implementations ;P What do I mean? Well to easily convert / write / use code from BOTH c# and VB.Net "_" simplifies a great bit... Mainly because vb.net is not case sensitive. I find the "_" char the least disturbing in reading / skimming through code. The m_ prefix i dislike the m_ prefix as I consider it outdated; as far as I know the m stands for member, and if I want to now a class member I take a look in the Object browser, or use the "Me" (this in c#) ex: Me._myFieldName therefore in my opinion -> m_ adds "nothing". As the previous post states, the _ is used for private members and therefore encapsulated by the class and you work with the public properties / methods instead i.o.w not that big of a problem (in my humble opinion) in contrast to language independence.

              S Offline
              S Offline
              Sarah Jane Snow
              wrote on last edited by
              #89

              Hi. I personally use mPrefix, no underscore, is that wrong somehow?

              J X 2 Replies Last reply
              0
              • S Sarah Jane Snow

                Hi. I personally use mPrefix, no underscore, is that wrong somehow?

                J Offline
                J Offline
                Jon W
                wrote on last edited by
                #90

                If it works for you then it's not wrong for you (but perhaps for the wider audience). Personally as stated before I think the m adds nothing. consider mAge _age with how reading letter work. The human mind skims quickly through text not reading character by character but rather ses the "image" of the word; therefore the m also disturbs the quick skimming and readability of the code. For more info on the subject see: http://www.microsoft.com/typography/ctfonts/WordRecognition.aspx#m1 Finally A good source (with comments, arguments) for naming convention: http://www.irritatedvowel.com/Programming/Standards.aspx

                S 1 Reply Last reply
                0
                • J Jon W

                  If it works for you then it's not wrong for you (but perhaps for the wider audience). Personally as stated before I think the m adds nothing. consider mAge _age with how reading letter work. The human mind skims quickly through text not reading character by character but rather ses the "image" of the word; therefore the m also disturbs the quick skimming and readability of the code. For more info on the subject see: http://www.microsoft.com/typography/ctfonts/WordRecognition.aspx#m1 Finally A good source (with comments, arguments) for naming convention: http://www.irritatedvowel.com/Programming/Standards.aspx

                  S Offline
                  S Offline
                  Sarah Jane Snow
                  wrote on last edited by
                  #91

                  Thanks Jon, I do believe you are correct, I think I'll change my ways.

                  1 Reply Last reply
                  0
                  • R Rocky Moore

                    Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                    Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                    N Offline
                    N Offline
                    Neil Walters
                    wrote on last edited by
                    #92

                    Personally I hate prefixes of any kind - one of my pet hates. I have seen code that mistakenly uses prefixes for local variable - an even greater pet hate. I prefer to use this.localVariable. At least that way you are guaranteed that the variable is a member variable.

                    1 Reply Last reply
                    0
                    • R Rocky Moore

                      Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                      Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                      D Offline
                      D Offline
                      dino t socrates
                      wrote on last edited by
                      #93

                      When my company started working with a third-party C# library a year or two ago, we noticed underscores for all the private fields. Some of our developers started doing the same thing and while I was a little skeptical at first, I decided to give it a try. It didn't take me very long to notice some really nice benefits to using them and now I don't think I will ever go back. In fact, we have since made it a "highly suggested" guideline for our developers, with nothing but praise for it. Here are some of the niceties I can think of: 1. Immediate differentiation between member fields and local/parameter variables. 2. As a result of #1 above, there is never clutter or confusion by needing to qualify member fields with the 'this' (or 'Me') keyword when setting them with local/parameter variables of the same name (typically done in constructors). 3. All private fields get grouped in Intellisense. With all that being said, I don't really understand how it makes reading code a pain. I think it does maybe take a little getting used to, but none of our developers have mentioned any problems with readability. Quite the contrary. Terry

                      1 Reply Last reply
                      0
                      • S Sarah Jane Snow

                        Hi. I personally use mPrefix, no underscore, is that wrong somehow?

                        X Offline
                        X Offline
                        xiaoyifang
                        wrote on last edited by
                        #94

                        only habit!! the reason is you learn to write in that way and got used to it

                        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