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. Style Cop

Style Cop

Scheduled Pinned Locked Moved The Lounge
39 Posts 15 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.
  • N Nish Nishant

    Not so much formatting as code styles and guidelines, like variable naming, comments, order of fields, methods etc.

    Regards, Nish


    My technology blog: voidnish.wordpress.com

    S Offline
    S Offline
    Slacker007
    wrote on last edited by
    #18

    Thanks for the correction. :)

    N 1 Reply Last reply
    0
    • S Slacker007

      Thanks for the correction. :)

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #19

      No problem :)

      Regards, Nish


      My technology blog: voidnish.wordpress.com

      S 1 Reply Last reply
      0
      • R Rob Philpott

        Mine and everyone else I know - yes.

        Regards, Rob Philpott.

        E Offline
        E Offline
        Electron Shepherd
        wrote on last edited by
        #20

        Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is customerAccountNumber better than CustomerAccountNumber or strCustomerAccountNumber or lpszCustomerAccountNumber ?

        Server and Network Monitoring

        R 1 Reply Last reply
        0
        • N Nish Nishant

          StyleCop is meant to be used on user-written source files. Do not use it on auto-generated files :-)

          Regards, Nish


          My technology blog: voidnish.wordpress.com

          R Offline
          R Offline
          realJSOP
          wrote on last edited by
          #21

          Hmmm, I always thought StyleCop was intended for the garbage can...

          .45 ACP - because shooting twice is just silly
          -----
          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

          1 Reply Last reply
          0
          • E Electron Shepherd

            Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is customerAccountNumber better than CustomerAccountNumber or strCustomerAccountNumber or lpszCustomerAccountNumber ?

            Server and Network Monitoring

            R Offline
            R Offline
            Rob Philpott
            wrote on last edited by
            #22

            Who knows? The point is convention. You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code. A good thing surely.

            Regards, Rob Philpott.

            E 1 Reply Last reply
            0
            • R Rob Philpott

              Who knows? The point is convention. You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code. A good thing surely.

              Regards, Rob Philpott.

              E Offline
              E Offline
              Electron Shepherd
              wrote on last edited by
              #23

              Rob Philpott wrote:

              Who knows? The point is convention.

              And that's my point. All you're saying is that being consistent is good, and being able to identify scope from name is good. But that's not a justification for using camel case. I've never seen a good reason why it's "better" than other naming standards, and I think it's worse. My deliberately chosen example is something that is conventionally called a number, but in the real world is very ofen a mixture of letters and numbers, and so has to be represented as a string. Using the camel case standard, you somethings can't infer data type from the name, which to me seems a backward step.

              Server and Network Monitoring

              R 1 Reply Last reply
              0
              • N Nish Nishant

                No problem :)

                Regards, Nish


                My technology blog: voidnish.wordpress.com

                S Offline
                S Offline
                Single Step Debugger
                wrote on last edited by
                #24

                self-satisfied swine :-D

                There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                N 1 Reply Last reply
                0
                • E Electron Shepherd

                  Rob Philpott wrote:

                  Who knows? The point is convention.

                  And that's my point. All you're saying is that being consistent is good, and being able to identify scope from name is good. But that's not a justification for using camel case. I've never seen a good reason why it's "better" than other naming standards, and I think it's worse. My deliberately chosen example is something that is conventionally called a number, but in the real world is very ofen a mixture of letters and numbers, and so has to be represented as a string. Using the camel case standard, you somethings can't infer data type from the name, which to me seems a backward step.

                  Server and Network Monitoring

                  R Offline
                  R Offline
                  Rob Philpott
                  wrote on last edited by
                  #25

                  Electron Shepherd wrote:

                  But that's not a justification for using camel case.

                  It absolutely is. Having a standard, even if its not very good is far better than everyone going off and doing their own thing. I never claimed camel case to be a good idea but it is the convention in the example given. Its a bit like suggesting you spell words the way they sound rather than the way they're spelled because it makes more sense.

                  Regards, Rob Philpott.

                  E 1 Reply Last reply
                  0
                  • S Single Step Debugger

                    self-satisfied swine :-D

                    There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #26

                    :laugh: -

                    Regards, Nish


                    My technology blog: voidnish.wordpress.com

                    S 1 Reply Last reply
                    0
                    • R Rob Philpott

                      Electron Shepherd wrote:

                      But that's not a justification for using camel case.

                      It absolutely is. Having a standard, even if its not very good is far better than everyone going off and doing their own thing. I never claimed camel case to be a good idea but it is the convention in the example given. Its a bit like suggesting you spell words the way they sound rather than the way they're spelled because it makes more sense.

                      Regards, Rob Philpott.

                      E Offline
                      E Offline
                      Electron Shepherd
                      wrote on last edited by
                      #27

                      Rob Philpott wrote:

                      But that's not a justification for using camel case

                      Rob Philpott wrote:

                      It absolutely is.

                      No, it's a justification for using a standard. It's not a justifcation for selecting camel case as that standard. Your point about "You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code." are entirely valid, and I agree with them, but they apply just as much to Hungarian notation as camel case.

                      Server and Network Monitoring

                      R 1 Reply Last reply
                      0
                      • N Nish Nishant

                        :laugh: -

                        Regards, Nish


                        My technology blog: voidnish.wordpress.com

                        S Offline
                        S Offline
                        Single Step Debugger
                        wrote on last edited by
                        #28

                        I know you have a nice sense of humor, that’s why I allow myself a crude jokes sometimes. :)

                        There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                        N 1 Reply Last reply
                        0
                        • E Electron Shepherd

                          Rob Philpott wrote:

                          But that's not a justification for using camel case

                          Rob Philpott wrote:

                          It absolutely is.

                          No, it's a justification for using a standard. It's not a justifcation for selecting camel case as that standard. Your point about "You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code." are entirely valid, and I agree with them, but they apply just as much to Hungarian notation as camel case.

                          Server and Network Monitoring

                          R Offline
                          R Offline
                          Rob Philpott
                          wrote on last edited by
                          #29

                          Electron Shepherd wrote:

                          But that's not a justification for using camel case

                          Electron Shepherd wrote:

                          It absolutely is.

                          Electron Shepherd wrote:

                          No, it's a justification for using a standard.

                          Uh-huh. Ok it's not a justification for using camel case for its own merit, its justification for using camel case because that is the standard. Better?

                          Regards, Rob Philpott.

                          E 1 Reply Last reply
                          0
                          • S Single Step Debugger

                            I know you have a nice sense of humor, that’s why I allow myself a crude jokes sometimes. :)

                            There is only one Ashley Judd and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                            N Offline
                            N Offline
                            Nish Nishant
                            wrote on last edited by
                            #30

                            Go ahead, we are all crude people here, so the cruder the humor, the funnier it is for all of us :)

                            Regards, Nish


                            My technology blog: voidnish.wordpress.com

                            1 Reply Last reply
                            0
                            • R Rob Philpott

                              Electron Shepherd wrote:

                              But that's not a justification for using camel case

                              Electron Shepherd wrote:

                              It absolutely is.

                              Electron Shepherd wrote:

                              No, it's a justification for using a standard.

                              Uh-huh. Ok it's not a justification for using camel case for its own merit, its justification for using camel case because that is the standard. Better?

                              Regards, Rob Philpott.

                              E Offline
                              E Offline
                              Electron Shepherd
                              wrote on last edited by
                              #31

                              Not really. It still doesn't explain why it's the standard in the first place. That's what I'm trying to userstand. Lots of people use camel case as a naming standard, but no-one seems able to say why it's better than the others. So, if you were tasked with developing a set of coding standards, and you decided to use camel case for variables, would you be explain to someone the benefits of that over an MFC-style str... or C-style lpsz... convention?

                              Server and Network Monitoring

                              R 1 Reply Last reply
                              0
                              • E Electron Shepherd

                                Not really. It still doesn't explain why it's the standard in the first place. That's what I'm trying to userstand. Lots of people use camel case as a naming standard, but no-one seems able to say why it's better than the others. So, if you were tasked with developing a set of coding standards, and you decided to use camel case for variables, would you be explain to someone the benefits of that over an MFC-style str... or C-style lpsz... convention?

                                Server and Network Monitoring

                                R Offline
                                R Offline
                                Rob Philpott
                                wrote on last edited by
                                #32

                                Dude, I've told you I don't know why it's the standard, probably because they nicked it from Java at a guess. Standards aren't always designed, sometimes they just get adopted and evolve despite being imperfect. Who knows? I would expect Hungarian got dropped due to the better Intellisense handling in Visual Studio at its mainstay 'p_' no longer holding any worth. In short its benefits got outweighed by its clumsiness.

                                Regards, Rob Philpott.

                                E 1 Reply Last reply
                                0
                                • R Rob Philpott

                                  Dude, I've told you I don't know why it's the standard, probably because they nicked it from Java at a guess. Standards aren't always designed, sometimes they just get adopted and evolve despite being imperfect. Who knows? I would expect Hungarian got dropped due to the better Intellisense handling in Visual Studio at its mainstay 'p_' no longer holding any worth. In short its benefits got outweighed by its clumsiness.

                                  Regards, Rob Philpott.

                                  E Offline
                                  E Offline
                                  Electron Shepherd
                                  wrote on last edited by
                                  #33

                                  Rob Philpott wrote:

                                  I don't know why it's the standard

                                  I'm not asking why it's the standard where you are. You seem to like it as a naming convention. What I'm asking is why you like it. Why do you think it's better than the others? I may have misinterpreted your opinion of course. You may dislike it as much as I do...

                                  Server and Network Monitoring

                                  R 1 Reply Last reply
                                  0
                                  • E Electron Shepherd

                                    Rob Philpott wrote:

                                    I don't know why it's the standard

                                    I'm not asking why it's the standard where you are. You seem to like it as a naming convention. What I'm asking is why you like it. Why do you think it's better than the others? I may have misinterpreted your opinion of course. You may dislike it as much as I do...

                                    Server and Network Monitoring

                                    R Offline
                                    R Offline
                                    Rob Philpott
                                    wrote on last edited by
                                    #34

                                    Actually, it's not something I feel deeply passionate about. Kind of indifferent to it as a choice, kind of like it because it is a standard and I can, for instance, tell what's a type (Pascal) and what's a variable (Camel) at a glance. Thank God, it's time to go to the pub now (almost)...

                                    Regards, Rob Philpott.

                                    1 Reply Last reply
                                    0
                                    • W wizardzz

                                      I started to check out StyleCop this morning. I'm not going to rant about every other rule it follows, but has anyone noticed that the file **.Designer.cs violates:

                                      SA1201: All methods must be placed after all fields.

                                      Windows creates this file. I think I'm done with StyleCop.

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

                                      I don't like style cop unless I am offshoring unthinking work to unthinking developers. True software is written by creative professionals. If I wanted to be micromanaged I would work in a call center.

                                      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                                      1 Reply Last reply
                                      0
                                      • N Nish Nishant

                                        No, FxCop and StyleCop are different. StyleCop analyzes your source code, whereas FxCop does static analysis on your compiled assembly. Normally you are supposed to use them together, so they complement each other.

                                        Regards, Nish


                                        My technology blog: voidnish.wordpress.com

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

                                        They complement each other, but they certainly don't compliment you. BTW - they work really well in combination with NDepend.

                                        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                                        Forgive your enemies - it messes with their heads

                                        My blog | My articles | MoXAML PowerToys | Onyx

                                        N 1 Reply Last reply
                                        0
                                        • P Pete OHanlon

                                          They complement each other, but they certainly don't compliment you. BTW - they work really well in combination with NDepend.

                                          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                                          Forgive your enemies - it messes with their heads

                                          My blog | My articles | MoXAML PowerToys | Onyx

                                          N Offline
                                          N Offline
                                          Nish Nishant
                                          wrote on last edited by
                                          #37

                                          Pete O'Hanlon wrote:

                                          BTW - they work really well in combination with NDepend.

                                          Interesting. Never used NDepend myself though.

                                          Regards, Nish


                                          My technology blog: voidnish.wordpress.com

                                          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