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.
  • 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
    Nordin Rahman
    wrote on last edited by
    #30

    I prefer GetValue() in .NET too. However, if I am trying to port getter/setter methods written in Java to .NET, it is better for me to write them in property syntax. eg (C#): private int value; /// /// Get and set the value /// public int Value { get { return value; } set { if (this.value != value) this.value = value); } } You can refer MS website regarding. http://msdn2.microsoft.com/en-us/ms229002(VS.80).aspx[^] :)

    I like you, and I love programming more.

    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
      Jasmine2501
      wrote on last edited by
      #31

      The problem is more with the name than that case. As long as you consistently use the same casing you won't have a problem. You should pick a better name than GetValue, though. Pick a name that indicates what you are getting - all of your accessor functions are going to "get a value" of some kind. I had a guy a while back who thought it was funny to give his stuff names like "process_something" and "my_string"... this bites you in the ass pretty quick.

      "Quality Software since 1983!"
      http://www.smoothjazzy.com/ - see the "Programming" section for freeware tools and articles.

      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.

        I Offline
        I Offline
        Igor Velikorossov
        wrote on last edited by
        #32

        I reckon if you use .NET you should stick with The Guidelines - Design Guidelines, Managed code and the .NET Framework[^]

        M 1 Reply 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

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

          Wouldn't that be: GETVALUE() ;)

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

          P 1 Reply Last reply
          0
          • D DavidNohejl

            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 Offline
            R Offline
            Rocky Moore
            wrote on last edited by
            #34

            dnh wrote:

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

            All ugly and should be banned! ;)

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

            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
              NileshBhatkhalkar
              wrote on last edited by
              #35

              Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar

              Cheers, Nilesh Prakash Bhatkhalkar

              C J 2 Replies Last reply
              0
              • N NileshBhatkhalkar

                Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar

                Cheers, Nilesh Prakash Bhatkhalkar

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #36

                NileshBhatkhalkar wrote:

                The standardization of naming conventions should be organization-wide and not restricted to any language.

                That's nice in theory, but if you look at the standard for Java and the standard for .NET you'll see they are different. If you implement an organisation wide standard that ignores the language you'll end up with two standards in one piece of code. One standard defined by your organisation and one standard defined by the language vendor. I've worked in a company that did that and quite frankly the code was a mess. When I moved to a new language I didn't immediately know where the framework stopped and the company's code started and I got myself in to a right mess when trying to figure out how to call stuff.

                NileshBhatkhalkar wrote:

                I hope this was helpful to you....

                Sorry, but experience has taught me that this is not the way to go. Be as consistent as possible by all means, but yield to the existing standards defined by the language vendor if need be.


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

                1 Reply Last reply
                0
                • C Christian Graus

                  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 Offline
                  P Offline
                  Paul Selormey
                  wrote on last edited by
                  #37

                  Christian Graus wrote:

                  Which languages are case insensitive ?

                  Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.

                  Christian Graus wrote:

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

                  Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.

                  Christian Graus wrote:

                  ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.

                  Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.

                  Christian Graus wrote:

                  It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.

                  Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.

                  Jesus Christ is LOVE! Please tell somebody.

                  C A 2 Replies Last reply
                  0
                  • I Igor Velikorossov

                    I reckon if you use .NET you should stick with The Guidelines - Design Guidelines, Managed code and the .NET Framework[^]

                    M Offline
                    M Offline
                    Monin D
                    wrote on last edited by
                    #38

                    good link, thanks

                    1 Reply Last reply
                    0
                    • P Paul Selormey

                      Christian Graus wrote:

                      Which languages are case insensitive ?

                      Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.

                      Christian Graus wrote:

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

                      Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.

                      Christian Graus wrote:

                      ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.

                      Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.

                      Christian Graus wrote:

                      It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.

                      Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.

                      Jesus Christ is LOVE! Please tell somebody.

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

                      Paul Selormey wrote:

                      I know of at least Fortran and there is a .NET version.

                      OK, I didn't know that.  I wonder mow many computers used upper and lower case when FORTRAN was developed ?

                      Paul Selormey wrote:

                      The history of C, the mother of C#

                      You're totally wrong.  C has nothing to do with C#, and C++ has next to nothing to do with C#.  They are totally unrelated.

                      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
                      • N NileshBhatkhalkar

                        Follow a consistent approach regardless of any language. The standardization of naming conventions should be organization-wide and not restricted to any language. Following are the advantages of adhering to common standards: • Programmers can go into any code and figure out the code easily and fast. • New people can get up to speed quickly. • People make fewer mistakes in consistent environments. • Increase the readability and maintainability of the code and hence the productivity of the team. So I would suggest you standardize the coding standards. :rolleyes: I hope this was helpful to you.... Thanks, Nilesh Bhatkhalkar

                        Cheers, Nilesh Prakash Bhatkhalkar

                        J Offline
                        J Offline
                        jcmaida
                        wrote on last edited by
                        #40

                        Nilesh, Your comments about naming conventions are exactly correct. Good words.:) Maida

                        1 Reply Last reply
                        0
                        • P Paul Selormey

                          Christian Graus wrote:

                          Which languages are case insensitive ?

                          Maybe for the .NET languages you have access to VB.NET. I know of at least Fortran and there is a .NET version.

                          Christian Graus wrote:

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

                          Of what value is the claim that var, Var and VAR are different? Windows is not case sensitive does not make it dump because UNIX/Linux is.

                          Christian Graus wrote:

                          ROTFL - you're obviously kidding around, but either way, I think a language being case insensitive is just plain dumb.

                          Fortran, SQL are case insensitive and I have never found them dump. They do just what they are designed to do and they do it perfectly. I used Fortran for both my MSc and PhD simulations work and never wished I used anything different.

                          Christian Graus wrote:

                          It's obviously a 'feature' added to VB.NET to make it easier, it's not something that has a real advantage beyond that.

                          Neither do I found the case sensitivity of C#/C/C++ to be off any special advantage. I will definitely not have method/function names like getValue and GetValue to mean different things in my code. If you will, simply accept that as a personal preference and has nothing to do with programming skill or whatever. The history of C, the mother of C#, tells you why they needed a case sensitivity. With love, Paul.

                          Jesus Christ is LOVE! Please tell somebody.

                          A Offline
                          A Offline
                          A J E E S H
                          wrote on last edited by
                          #41

                          Paul Selormey wrote:

                          The history of C, the mother of C#, tells you why they needed a case sensitivity.

                          Can you please say why?:)

                          Regards, --=A J E E S H=--

                          P 1 Reply Last reply
                          0
                          • A A J E E S H

                            Paul Selormey wrote:

                            The history of C, the mother of C#, tells you why they needed a case sensitivity.

                            Can you please say why?:)

                            Regards, --=A J E E S H=--

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

                            Which part, that it is the mother of C#, or case sensitivity? With love, Paul.

                            Jesus Christ is LOVE! Please tell somebody.

                            A 1 Reply Last reply
                            0
                            • C Christian Graus

                              Paul Selormey wrote:

                              I know of at least Fortran and there is a .NET version.

                              OK, I didn't know that.  I wonder mow many computers used upper and lower case when FORTRAN was developed ?

                              Paul Selormey wrote:

                              The history of C, the mother of C#

                              You're totally wrong.  C has nothing to do with C#, and C++ has next to nothing to do with C#.  They are totally unrelated.

                              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
                              #43

                              Christian Graus wrote:

                              You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.

                              How about listening to the Guy who did it...[^] With love, Paul.

                              Jesus Christ is LOVE! Please tell somebody.

                              C 1 Reply Last reply
                              0
                              • P Paul Selormey

                                Christian Graus wrote:

                                You're totally wrong. C has nothing to do with C#, and C++ has next to nothing to do with C#. They are totally unrelated.

                                How about listening to the Guy who did it...[^] With love, Paul.

                                Jesus Christ is LOVE! Please tell somebody.

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

                                I don't care what the marketing speak is, anyone who knows anything about C++ and Java can tell that C# comes from Java.  It's named C# to get people to associate it with C++.  I've seen tons of people online who say 'C# is faster than VB.NET because it comes from C++'.  Not so.  Nor does it act like C++.  It acts like Java.

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

                                1 Reply Last reply
                                0
                                • P Paul Selormey

                                  Which part, that it is the mother of C#, or case sensitivity? With love, Paul.

                                  Jesus Christ is LOVE! Please tell somebody.

                                  A Offline
                                  A Offline
                                  A J E E S H
                                  wrote on last edited by
                                  #45

                                  Hi paul, Case sensitivity

                                  Regards, --=A J E E S H=--

                                  P 1 Reply Last reply
                                  0
                                  • R Rocky Moore

                                    Wouldn't that be: GETVALUE() ;)

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

                                    P Offline
                                    P Offline
                                    pita2000
                                    wrote on last edited by
                                    #46

                                    no , this syntax is for constant pita2000

                                    1 Reply Last reply
                                    0
                                    • A A J E E S H

                                      Hi paul, Case sensitivity

                                      Regards, --=A J E E S H=--

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

                                      Read the C-History...the abstract is enough.[^] Best regards, Paul.

                                      Jesus Christ is LOVE! Please tell somebody.

                                      A 1 Reply Last reply
                                      0
                                      • P Paul Selormey

                                        Read the C-History...the abstract is enough.[^] Best regards, Paul.

                                        Jesus Christ is LOVE! Please tell somebody.

                                        A Offline
                                        A Offline
                                        A J E E S H
                                        wrote on last edited by
                                        #48

                                        Hi Paul Selormey, Thanks for the link.:)

                                        Regards, --=A J E E S H=--

                                        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