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. Name Conventions

Name Conventions

Scheduled Pinned Locked Moved The Lounge
question
48 Posts 31 Posters 6 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.
  • M Monin D

    Hello, When i should to name method with uppercase letter and when not? When I should use getValue() and when GetValue()? Thanks.

    E Offline
    E Offline
    Ennis Ray Lynch Jr
    wrote on last edited by
    #8

    camelCase for members, variables, and parameters. PascalCase for methods, Events, and Properties. Of course we all know that Java style is far superior I don't know why the folks at MS tried to dictate a different style.


    File Not Found

    T 1 Reply Last reply
    0
    • A alex barylski

      I typically use an prefixed underscore to indicate private/protected members :) Not that anyone would care :P

      I finally got a job doing something I enjoy and I"m good at...15 hour days seem like play time :P

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #9

      I thought we were talking about methods.   For variables and properties, I do the same.  upper/lower case differences are not enough to be CLS compiant, because VB sucks.

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      P S 2 Replies Last reply
      0
      • E Ennis Ray Lynch Jr

        camelCase for members, variables, and parameters. PascalCase for methods, Events, and Properties. Of course we all know that Java style is far superior I don't know why the folks at MS tried to dictate a different style.


        File Not Found

        T Offline
        T Offline
        Tim Craig
        wrote on last edited by
        #10

        Ennis Ray Lynch, Jr. wrote:

        I don't know why the folks at MS tried to dictate a different style.

        Because Not Invented Here is alive and rampant at Microsoft. They just, a priori, know what's right.

        The evolution of the human genome is too important to be left to chance idiots like CSS.

        G 1 Reply Last reply
        0
        • M Monin D

          Hello, When i should to name method with uppercase letter and when not? When I should use getValue() and when GetValue()? Thanks.

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #11

          http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html[^]

          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

          1 Reply Last reply
          0
          • C Christian Graus

            I thought we were talking about methods.   For variables and properties, I do the same.  upper/lower case differences are not enough to be CLS compiant, because VB sucks.

            Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

            P Offline
            P Offline
            Paul Selormey
            wrote on last edited by
            #12

            Christian Graus wrote:

            CLS compiant, because VB sucks.

            Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode. BTW, it is your perfect C# compiler that will complain. If you write and consume your components only in C#, just remove the CLS compliant attribute, and stop blaming VB for your bugs ;P With love, Paul.

            Jesus Christ is LOVE! Please tell somebody.

            C N 2 Replies Last reply
            0
            • A alex barylski

              I typically use an prefixed underscore to indicate private/protected members :) Not that anyone would care :P

              I finally got a job doing something I enjoy and I"m good at...15 hour days seem like play time :P

              E Offline
              E Offline
              Eytukan
              wrote on last edited by
              #13

              Hockey wrote:

              I typically use an prefixed underscore

              Element names starting with an underscore (_) are not part of the Common Language Specification (CLS), so CLS-compliant code cannot use a component that defines such names.^:->


              Code-Frog:So if this is Pumpkinhead. Time for him to run and hide. It's an interesting thought really.

              D S 2 Replies Last reply
              0
              • C Colin Angus Mackay

                Use getValue() in Java and GetValue() in .NET


                Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                A Offline
                A Offline
                Aryo Handono
                wrote on last edited by
                #14

                How about in VB ? ;P

                "Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core "Press any key to continue, where's the ANY key ?" - Homer Simpsons Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03

                D R 2 Replies Last reply
                0
                • A Aryo Handono

                  How about in VB ? ;P

                  "Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core "Press any key to continue, where's the ANY key ?" - Homer Simpsons Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03

                  D Offline
                  D Offline
                  Duncan Edwards Jones
                  wrote on last edited by
                  #15

                  Use GetValue() in VB - ....although if you are a proper VB programmer you'll probably be a bit more explicit about what the Value is...

                  '--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd

                  1 Reply Last reply
                  0
                  • C Colin Angus Mackay

                    Use getValue() in Java and GetValue() in .NET


                    Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                    N Offline
                    N Offline
                    NormDroid
                    wrote on last edited by
                    #16

                    ... or even just Value for accessing a property.

                    We made the buttons on the screen look so good you'll want to lick them. Steve Jobs

                    1 Reply Last reply
                    0
                    • E Eytukan

                      Hockey wrote:

                      I typically use an prefixed underscore

                      Element names starting with an underscore (_) are not part of the Common Language Specification (CLS), so CLS-compliant code cannot use a component that defines such names.^:->


                      Code-Frog:So if this is Pumpkinhead. Time for him to run and hide. It's an interesting thought really.

                      D Offline
                      D Offline
                      DavidNohejl
                      wrote on last edited by
                      #17

                      I think that applies to public members/fields only.


                      "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

                      1 Reply Last reply
                      0
                      • P Paul Selormey

                        Christian Graus wrote:

                        CLS compiant, because VB sucks.

                        Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode. BTW, it is your perfect C# compiler that will complain. If you write and consume your components only in C#, just remove the CLS compliant attribute, and stop blaming VB for your bugs ;P With love, Paul.

                        Jesus Christ is LOVE! Please tell somebody.

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #18

                        Paul Selormey wrote:

                        Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode.

                        True -and to make it language independant, they needed to make it case insensitive.  Which languages are case insensitive ?

                        Paul Selormey wrote:

                        BTW, it is your perfect C# compiler that will complain.

                        Of course it will.  The VB.NET compiler is too stupid to see a difference between var, Var and VAR to start with.

                        Paul Selormey wrote:

                        just remove the CLS compliant attribute,

                        I've been known to do that, actually

                        Paul Selormey wrote:

                        and stop blaming VB for your bugs

                        ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.  It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.

                        Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                        P 1 Reply Last reply
                        0
                        • E Eytukan

                          Hockey wrote:

                          I typically use an prefixed underscore

                          Element names starting with an underscore (_) are not part of the Common Language Specification (CLS), so CLS-compliant code cannot use a component that defines such names.^:->


                          Code-Frog:So if this is Pumpkinhead. Time for him to run and hide. It's an interesting thought really.

                          S Offline
                          S Offline
                          Steve Hansen
                          wrote on last edited by
                          #19

                          However, an underscore in any other position in an element name is CLS-compliant.

                          So it only matters for public properties/methods which I don't think they do. Just for fields like I do.

                          D 1 Reply Last reply
                          0
                          • S Steve Hansen

                            However, an underscore in any other position in an element name is CLS-compliant.

                            So it only matters for public properties/methods which I don't think they do. Just for fields like I do.

                            D Offline
                            D Offline
                            DavidNohejl
                            wrote on last edited by
                            #20

                            Steve Hansen wrote:

                            However, an underscore in any other position in an element name is CLS-compliant.

                            I understood this as _element is invalid, but element_, my_element etc are OK.

                            Steve Hansen wrote:

                            So it only matters for public properties/methods which I don't think they do.

                            Agreed.


                            "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

                            R 1 Reply Last reply
                            0
                            • M Monin D

                              Hello, When i should to name method with uppercase letter and when not? When I should use getValue() and when GetValue()? Thanks.

                              J Offline
                              J Offline
                              Jonas Hammarberg
                              wrote on last edited by
                              #21

                              Be consistent. If maintaining, adapt (even if it's wrong -- or rewrite the whole lot, there are beautifiers). As you gather wisdom, you will develop your own style;) I heard about a company using beautifiers. Many of the coders had their own style and instead of going to war over brackets and spaces the company decided on what style the code should comfirm to when checked in. What style each and one of the coders used when working on their parts was irrelevant. rgds /Jonas

                              1 Reply Last reply
                              0
                              • A alex barylski

                                I typically use an prefixed underscore to indicate private/protected members :) Not that anyone would care :P

                                I finally got a job doing something I enjoy and I"m good at...15 hour days seem like play time :P

                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #22

                                OMG. There's another one us out there that uses this convention. I'm not alone anymore. (sniff)


                                Software Zen: delete this;

                                P 1 Reply Last reply
                                0
                                • C Christian Graus

                                  I thought we were talking about methods.   For variables and properties, I do the same.  upper/lower case differences are not enough to be CLS compiant, because VB sucks.

                                  Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                                  S Offline
                                  S Offline
                                  subai
                                  wrote on last edited by
                                  #23

                                  i used to (and i like to) use prefix underscore in private members but it's not recommended by the boss(it's forbidden) :(

                                  I Wish the Life Had CTRL-Z

                                  1 Reply Last reply
                                  0
                                  • G Gary Wheeler

                                    OMG. There's another one us out there that uses this convention. I'm not alone anymore. (sniff)


                                    Software Zen: delete this;

                                    P Offline
                                    P Offline
                                    Pete OHanlon
                                    wrote on last edited by
                                    #24

                                    I do, but only for private members. As has been written elsewhere, underscores on protected members will raise errors because they are not CLS Compliant.

                                    the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                                    Deja View - the feeling that you've seen this post before.

                                    G 1 Reply Last reply
                                    0
                                    • P Pete OHanlon

                                      I do, but only for private members. As has been written elsewhere, underscores on protected members will raise errors because they are not CLS Compliant.

                                      the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                                      Deja View - the feeling that you've seen this post before.

                                      G Offline
                                      G Offline
                                      Gary Wheeler
                                      wrote on last edited by
                                      #25

                                      Our naming conventions are something like this: PascalCase for public classes, members, 'file' static values, and globals. _PascalCaseWithLeadingUnderscore for private/protected classes and members. camelCase or lower_case_with_underscores for local variables. ALL_UPPER_CASE_FOR_DEFINES which are required to be manifest constants only. If we ever start doing .NET development (we're currently a C++/MFC house), we may need to modify our conventions. .NET enforcing a naming convention is annoyingly reminiscent of the Ada development tools I had to deal with back in the late 80's. They were equally obnoxious about requiring adherence to some academic's notion of proper programming technique. I am of the "Grady Booch must die" programming school, myself :|.


                                      Software Zen: delete this;

                                      1 Reply Last reply
                                      0
                                      • T Tim Craig

                                        Ennis Ray Lynch, Jr. wrote:

                                        I don't know why the folks at MS tried to dictate a different style.

                                        Because Not Invented Here is alive and rampant at Microsoft. They just, a priori, know what's right.

                                        The evolution of the human genome is too important to be left to chance idiots like CSS.

                                        G Offline
                                        G Offline
                                        Gary Wheeler
                                        wrote on last edited by
                                        #26

                                        Tim Craig wrote:

                                        They just, a priori, know what's right

                                        How does an 800 pound gorilla write software? (wait for it) However he likes.


                                        Software Zen: delete this;

                                        1 Reply Last reply
                                        0
                                        • P Paul Selormey

                                          Christian Graus wrote:

                                          CLS compiant, because VB sucks.

                                          Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode. BTW, it is your perfect C# compiler that will complain. If you write and consume your components only in C#, just remove the CLS compliant attribute, and stop blaming VB for your bugs ;P With love, Paul.

                                          Jesus Christ is LOVE! Please tell somebody.

                                          N Offline
                                          N Offline
                                          Nemanja Trifunovic
                                          wrote on last edited by
                                          #27

                                          Paul Selormey wrote:

                                          Wrong, it is because CLS==language independence, a feature it boasts off over Java bytecode.

                                          Off topic: Java bytecode is language independent as well, and there are some very nice languages that target JVM, such as Scala[^], Nice[^] and Groovy[^]. Note that I don't count Java as a nice language for JVM ;)


                                          Programming Blog utf8-cpp

                                          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