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. One-garian Notation

One-garian Notation

Scheduled Pinned Locked Moved The Lounge
csharpcomquestion
61 Posts 24 Posters 0 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.
  • B Brady Kelly

    Nagy Vilmos wrote:

    It's an inoquous phrase - literaly 'your mother'

    You should see what that same inoquous phrase will win you in SA as well, especially Cape Town.

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #44

    Ventilation holes? About 9mm diameter? :laugh:

    I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    M 1 Reply Last reply
    0
    • R RenniePet

      Uh, yeah. Visual Studio 2010. It says:

      Error 1 The type 'ConsoleApplication1.Program' already contains a definition for 'ProcessStatus'

      on the line that attempts to define a property with the same name as the enumerator.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #45

      Probably only if your enum is defined as part of your class (MyNamespace.MyClass.MyEnum) If it is defined as outside your class (MyNamespace.MyClass and MyNamespace.MyEnum) then it probably won't - certainly VS2008 doesn't. Which makes sense, because in the first case you are indeed trying to define two things (the enum and the instance) with identical fully qualified names, and the compiler cannot resolve the reference.

      I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      L R 2 Replies Last reply
      0
      • OriginalGriffO OriginalGriff

        Probably only if your enum is defined as part of your class (MyNamespace.MyClass.MyEnum) If it is defined as outside your class (MyNamespace.MyClass and MyNamespace.MyEnum) then it probably won't - certainly VS2008 doesn't. Which makes sense, because in the first case you are indeed trying to define two things (the enum and the instance) with identical fully qualified names, and the compiler cannot resolve the reference.

        I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #46

        yep. you're right. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        If you want my opinion or comment, ask in a forum or on my profile page; I will not participate in frackin' Q&A


        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          Probably only if your enum is defined as part of your class (MyNamespace.MyClass.MyEnum) If it is defined as outside your class (MyNamespace.MyClass and MyNamespace.MyEnum) then it probably won't - certainly VS2008 doesn't. Which makes sense, because in the first case you are indeed trying to define two things (the enum and the instance) with identical fully qualified names, and the compiler cannot resolve the reference.

          I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

          R Offline
          R Offline
          RenniePet
          wrote on last edited by
          #47

          That's true, but in many situations I prefer to define the enum in the class where it is to be used and made public. There is a longer discussion about this here: http://stackoverflow.com/questions/495051/c-naming-convention-for-enum-and-matching-property[^] If you look at that thread, the third-last post by someone named Hermann was the inspiration to my beginning heresy. :) C for constants and D for delegates came next, and my chances of redemption were gone. But I've resisted F for flag-style enumerators so far, although I'm not sure how much longer I can fight off the temptation. :(

          D 1 Reply Last reply
          0
          • R RenniePet

            That's true, but in many situations I prefer to define the enum in the class where it is to be used and made public. There is a longer discussion about this here: http://stackoverflow.com/questions/495051/c-naming-convention-for-enum-and-matching-property[^] If you look at that thread, the third-last post by someone named Hermann was the inspiration to my beginning heresy. :) C for constants and D for delegates came next, and my chances of redemption were gone. But I've resisted F for flag-style enumerators so far, although I'm not sure how much longer I can fight off the temptation. :(

            D Offline
            D Offline
            Daniel Grunwald
            wrote on last edited by
            #48

            That goes about against every .NET guideline there is. Nested classes/enums should NOT be public. They're hard to discover and annoying to use. Move the enum out of the class if it needs to be public. Flag-style enums use plural names while normal enums use singular names. There's no need for any prefix.

            R 1 Reply Last reply
            0
            • R RenniePet

              Here: http://blogs.msdn.com/kcwalina/archive/2004/11/03/251722.aspx[^] But I should have said "generic types", not just types.

              B Offline
              B Offline
              Brady Kelly
              wrote on last edited by
              #49

              I should have recognised the T type as such anyway, hehe. It's Sunday, what can I say - beer is calling.

              1 Reply Last reply
              0
              • R RenniePet

                Beware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #50

                No no no. Defines and enums in UPPERCASE. Consts and vaars just named properly. 'Name' is obviously a string, 'Count' is a number. and are nouns. And funcitons/methods are verbs. Easy. The code reads like english.

                Morality is indistinguishable from social proscription

                R 1 Reply Last reply
                0
                • OriginalGriffO OriginalGriff

                  Ventilation holes? About 9mm diameter? :laugh:

                  I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in. Apathy Error: Don't bother striking any key.

                  M Offline
                  M Offline
                  Mustafa Ismail Mustafa
                  wrote on last edited by
                  #51

                  That's what it would do in Jordan...

                  If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                  1 Reply Last reply
                  0
                  • D Daniel Grunwald

                    That goes about against every .NET guideline there is. Nested classes/enums should NOT be public. They're hard to discover and annoying to use. Move the enum out of the class if it needs to be public. Flag-style enums use plural names while normal enums use singular names. There's no need for any prefix.

                    R Offline
                    R Offline
                    RenniePet
                    wrote on last edited by
                    #52

                    > Flag-style enums use plural names while normal enums use singular names. As far as I'm concerned that's just another kind of Hungarian notation.

                    1 Reply Last reply
                    0
                    • L Lost User

                      No no no. Defines and enums in UPPERCASE. Consts and vaars just named properly. 'Name' is obviously a string, 'Count' is a number. and are nouns. And funcitons/methods are verbs. Easy. The code reads like english.

                      Morality is indistinguishable from social proscription

                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #53

                      Seconded.

                      “Follow your bliss.” – Joseph Campbell

                      1 Reply Last reply
                      0
                      • R RenniePet

                        Beware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of

                        R Offline
                        R Offline
                        Roger Wright
                        wrote on last edited by
                        #54

                        The only notation I adhere to religiously is Reverse Polish Notation. No other method of calculation makes any sense whatsoever unless one is limited to balancing checkbooks.

                        "A Journey of a Thousand Rest Stops Begins with a Single Movement"

                        1 Reply Last reply
                        0
                        • R RenniePet

                          Beware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of

                          M Offline
                          M Offline
                          Mark_Wallace
                          wrote on last edited by
                          #55

                          A few months ago, I absent-mindedly started a string with "$". It just felt like the thing to do at the time. Fortunately, I managed to delete it before anyone noticed.

                          I wanna be a eunuchs developer! Pass me a bread knife!

                          1 Reply Last reply
                          0
                          • R RenniePet

                            Beware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of

                            M Offline
                            M Offline
                            Member 96
                            wrote on last edited by
                            #56

                            "A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines." - Emerson


                            Yesterday they said today was tomorrow but today they know better. - Poul Anderson

                            1 Reply Last reply
                            0
                            • R RenniePet

                              Wow, lots of comments! :) But I'd like to ask if anyone has any opinion regarding my suggesions, which I'm actually quite serious about, despite the humorous tone of my posting? - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. Justifications: - Previous standard for constants was THE_UPPERCASE_SCREAMING style, because constants are different. So I want to still emphasise that constants are different, and adding the C does that. - I often have a delegate declaration that is for a specific method, so it makes sense to use the name of the method with the D added to the front. - The use of enumerators often involves declaring a usage of the enumerator that naturally would have the same name as the enumerator itself, which isn't allowed. So by saying the enumerator name starts with E then the usage can have the same name without the E. Just like with INames for interfaces and TNames for types, these three things are sufficiently different from run-of-the-mill items that I like the idea of giving them special names.

                              A Offline
                              A Offline
                              agolddog
                              wrote on last edited by
                              #57

                              We were just discussing this the other day. I'm old enough to remember why naming conventions were thought important. When you're poring through stacks of paper source code, trying to identify what type of variable this is, or how it's initialized, mistakes are lessened if we all follow a pattern (whatever it is). Those days are long gone. With the advent of useful IDEs (Go to Definition), tracing the name is much more trivial and less error-prone. Now, that's not to say we shouldn't have standards; it's good to have the at-a-glance indication that the thing I'm viewing is a TextBox, or maybe a member variable of this method, or a property. But if we're spending our time chasing down those things instead of the actual problems in logic, we're doing a bad thing.

                              1 Reply Last reply
                              0
                              • A AspDotNetDev

                                OriginalGriff wrote:

                                "but" for buttons

                                But, but, but... why not "btn"? ;P

                                OriginalGriff wrote:

                                "tb" in front of text boxes

                                I use "txt", but "tb" does make perfect sense too.

                                [Forum Guidelines]

                                R Offline
                                R Offline
                                Rob Grainger
                                wrote on last edited by
                                #58

                                aspdotnetdev wrote:

                                I use "txt", but "tb" does make perfect sense too.

                                Unless you also have a toolbar on your form ;-)

                                1 Reply Last reply
                                0
                                • S Software_Developer

                                  Question: what do you call a char *? char * pntrCharArray = "Char Pointer"; CString cstrString;

                                  M Offline
                                  M Offline
                                  Miles Dalton Davies
                                  wrote on last edited by
                                  #59

                                  TopCoder23 wrote:

                                  Question: what do you call a char *? char * pntrCharArray = "Char Pointer"; CString cstrString;

                                  // if the pointer will not be used for any other strings LPCTSTR typeName = _T("Char Pointer") ;

                                  1 Reply Last reply
                                  0
                                  • R RenniePet

                                    Wow, lots of comments! :) But I'd like to ask if anyone has any opinion regarding my suggesions, which I'm actually quite serious about, despite the humorous tone of my posting? - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. Justifications: - Previous standard for constants was THE_UPPERCASE_SCREAMING style, because constants are different. So I want to still emphasise that constants are different, and adding the C does that. - I often have a delegate declaration that is for a specific method, so it makes sense to use the name of the method with the D added to the front. - The use of enumerators often involves declaring a usage of the enumerator that naturally would have the same name as the enumerator itself, which isn't allowed. So by saying the enumerator name starts with E then the usage can have the same name without the E. Just like with INames for interfaces and TNames for types, these three things are sufficiently different from run-of-the-mill items that I like the idea of giving them special names.

                                    M Offline
                                    M Offline
                                    Miles Dalton Davies
                                    wrote on last edited by
                                    #60

                                    Hungarian fails not only because in the world of modern IDEs it has less intrinsic value but it also makes it a pain to maintain code. Before deploying any convention ask if it really adds any value and what pain could it cause in the future? If these conventions make sense for you to adopt then go for it ! I, however, will probably not be following your pioneering lead. At least in the near term.

                                    1 Reply Last reply
                                    0
                                    • R RenniePet

                                      Beware all those who read the following, they are the irreverent ramblings of a heretic ... Religious beliefs are so tricky. For the true believer no alternatives can be possible. Their minds are closed. I was once a devout believer of Hungarian notation. Charles Simonyi was my guiding light. My strings were all szDecorated, and I was at peace with the world. But, as with all religions, there were those who would not accept the one true way. Hedonistic forces held sway at Microsoft, and .Net naming conventions repudiated Hungarian notation! I was thrown into confusion, and my world disintegrated around me! Had I been led astray? Were my beliefs really so faulty? All those years, for nothing? And then I noticed something incredibly suspect about the preachings of the anti-Hungarian notationalists. Despite their adamant claim that Hungarian notation was evil, they in reality espoused a corrupted form of Hungarian notation themselves! Yes, it is true, the anti-Hungarian notationalists are inconsistent! They call for the abolition of Hungarian notation, while preaching the following doctrine: - The names of interfaces must start with the letter I. - The names of types must start with the letter T. Why was this? How could they ask me to give up one faith for a new one that contradicted itself? And then one day my turmoil was resolved! In a moment of revelation the great nerd in the sky spoke to me: "Do not follow the preaching of others! Create your own religion, be true to yourself, and say to hell with the forces of conformity. It will be a rocky road, and you will be held in contempt, but you will discover an inner peace that not even Hungarian notation gave you." I call my new religion "one-garian notation". It can be considered to be a further development (or corruption, if you will) of the .Net naming conventions, where not just the names of interfaces and types have specific one-character prefixes, but the following as well: - The names of constants must start with the letter C. - The names of delegates must start with the letter D. - The names of enumerators must start with the letter E. That's it. One-garian notation (named because it is based on one-character prefixes) is the same as .Net naming conventions, plus the use of three additional one-character rules, for a total of

                                      C Offline
                                      C Offline
                                      Chesare
                                      wrote on last edited by
                                      #61

                                      Great comment, and pretty funny way to write. I'llfollow you. I'll keep using hungarian notattion for C/C++ aplications though; I like 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