Coding Standards

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • UJ

    Coding Standards

    Folks,
    Can anybody point me towards a site that explains the Microsoft Coding
    Standards? I downloaded FXCop and understandably it's complaining a lot.

    I do have questions though:

    1. What if any prefixes should be used to define scope of variables.
    2. How are people naming properties? I currently use a prefix of prp so
    they are all grouped together and easy to find. FXCop doesn't like that.

    Any thoughts or suggestions would be appreciated.

    TIA - Jeff.


  • Ignacio Machin \( .NET/ C# MVP \)

    #2
    Re: Coding Standards

    Hi,

    "UJ" <fred@nowhere.c om> wrote in message
    news:e0LK7pjMGH A.2696@TK2MSFTN GP14.phx.gbl...[color=blue]
    > Folks,
    > Can anybody point me towards a site that explains the Microsoft Coding
    > Standards? I downloaded FXCop and understandably it's complaining a lot.
    >
    > I do have questions though:
    >
    > 1. What if any prefixes should be used to define scope of variables.
    > 2. How are people naming properties? I currently use a prefix of prp so
    > they are all grouped together and easy to find. FXCop doesn't like that.[/color]

    Don't FxCop gives you a link to where you can see a detailed explanation
    of why it flagged it?

    Anyway, see

    for further details


    cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation



    Comment

    • Vadym Stetsyak

      #3
      Re: Coding Standards

      Hello, UJ!

      Take a look at
      ( http://msdn.microsoft.com/library/de...Guidelines.asp )
      ( http://blogs.msdn.com/brada/articles/361363.aspx )

      --
      Regards, Vadym Stetsyak
      www: http://vadmyst.blogspot.com

      Comment

      • Nick Hounsome

        #4
        Re: Coding Standards


        "UJ" <fred@nowhere.c om> wrote in message
        news:e0LK7pjMGH A.2696@TK2MSFTN GP14.phx.gbl...[color=blue]
        > Folks,
        > Can anybody point me towards a site that explains the Microsoft Coding
        > Standards? I downloaded FXCop and understandably it's complaining a lot.
        >
        > I do have questions though:
        >
        > 1. What if any prefixes should be used to define scope of variables.
        > 2. How are people naming properties? I currently use a prefix of prp so
        > they are all grouped together and easy to find. FXCop doesn't like that.[/color]

        Thank goodness.

        Do you really think that it is helpful to use a totally different convetion
        to all the microsoft stuff and everything ever written in any book I have
        ever read?

        Just as an example: If I want the address of a person then I expect to find
        it named "Address" - It will probably be a property but if it's a method
        then that's cool too.

        So I type 'A' and there it will be in intellisense near the top of the list.
        How is this better than typing "prpA"?

        Even if somehow it does help you when you are developing your code this is
        irrelevant as the main aim with methods and properties is to name them in a
        way that is helpful to users of the class.





        Comment

        • Greg

          #5
          Re: Coding Standards

          UJ,

          I'm finding the following very useful for this:


          Regards,

          Greg

          Comment

          • Michael Nemtsev

            #6
            Re: Coding Standards

            Using convention strongly is usefull in the bounds of company, to give u
            solid code understanding and improve readability.

            Conventions in artives and magazines are simplified, because author want to
            show you the gist of the code.
            In your case, Address means a property, coz it's common for the properties
            to start with capital letter.
            We more read then type, and for this reason the usability of typing doesn't
            make sence - there are several VSIDE addings, that improve intelliscence and
            could show you either properties or methods first.
            The idea to make code readable.

            Hungarian notation lost its sence due to metadates in .net - we move mouse
            over the method/property and we got description.
            [color=blue]
            > Do you really think that it is helpful to use a totally different convetion
            > to all the microsoft stuff and everything ever written in any book I have
            > ever read?
            >
            > Just as an example: If I want the address of a person then I expect to find
            > it named "Address" - It will probably be a property but if it's a method
            > then that's cool too.
            >
            > So I type 'A' and there it will be in intellisense near the top of the list.
            > How is this better than typing "prpA"?
            >
            > Even if somehow it does help you when you are developing your code this is
            > irrelevant as the main aim with methods and properties is to name them in a
            > way that is helpful to users of the class.[/color]

            --
            WBR,
            Michael Nemtsev :: blog: http://spaces.msn.com/laflour

            "At times one remains faithful to a cause only because its opponents do not
            cease to be insipid." (c) Friedrich Nietzsche


            Comment

            • dotnetchic

              #7
              Re: Coding Standards

              Jeff,
              Below is a site with a link to a standards document that I've adopted.
              It hasn't been updated in a while, but it was pretty complete to begin
              with.



              The only hungarian notation that I still use is with windows form
              control names (i.e., btnApply, etc) to help in finding them quickly.
              Private field names prefixed with underscore comes in handy.

              BTW, I think it's great that there are others out there at least trying
              to adhere to a standard.

              -SLC

              Comment

              • UJ

                #8
                Re: Coding Standards

                Thanks for the info.

                Can you suggest any of the VS IDE Add-ons that will improve intellisense?

                TIA - Jeff

                "Michael Nemtsev" <MichaelNemtsev @discussions.mi crosoft.com> wrote in
                message news:785CAFFF-2353-4FA8-BDA0-5581AB2D26BE@mi crosoft.com...[color=blue]
                > Using convention strongly is usefull in the bounds of company, to give u
                > solid code understanding and improve readability.
                >
                > Conventions in artives and magazines are simplified, because author want
                > to
                > show you the gist of the code.
                > In your case, Address means a property, coz it's common for the properties
                > to start with capital letter.
                > We more read then type, and for this reason the usability of typing
                > doesn't
                > make sence - there are several VSIDE addings, that improve intelliscence
                > and
                > could show you either properties or methods first.
                > The idea to make code readable.
                >
                > Hungarian notation lost its sence due to metadates in .net - we move
                > mouse
                > over the method/property and we got description.
                >[color=green]
                >> Do you really think that it is helpful to use a totally different
                >> convetion
                >> to all the microsoft stuff and everything ever written in any book I have
                >> ever read?
                >>
                >> Just as an example: If I want the address of a person then I expect to
                >> find
                >> it named "Address" - It will probably be a property but if it's a method
                >> then that's cool too.
                >>
                >> So I type 'A' and there it will be in intellisense near the top of the
                >> list.
                >> How is this better than typing "prpA"?
                >>
                >> Even if somehow it does help you when you are developing your code this
                >> is
                >> irrelevant as the main aim with methods and properties is to name them in
                >> a
                >> way that is helpful to users of the class.[/color]
                >
                > --
                > WBR,
                > Michael Nemtsev :: blog: http://spaces.msn.com/laflour
                >
                > "At times one remains faithful to a cause only because its opponents do
                > not
                > cease to be insipid." (c) Friedrich Nietzsche
                >
                >[/color]


                Comment

                • halvard.hagesaether@cmacontiki.com

                  #9
                  Re: Coding Standards

                  Try FxCop. It's not for improving intellisense, but Microsofts own tool
                  for checking code. It will flag anything that break their naming
                  conventions. They also give well explained reasons for their naming
                  convention rules.

                  And, even though it is Microsoft, it is free ...

                  Halvard.


                  UJ skrev:[color=blue]
                  > Thanks for the info.
                  >
                  > Can you suggest any of the VS IDE Add-ons that will improve intellisense?
                  >
                  > TIA - Jeff
                  >
                  > "Michael Nemtsev" <MichaelNemtsev @discussions.mi crosoft.com> wrote in
                  > message news:785CAFFF-2353-4FA8-BDA0-5581AB2D26BE@mi crosoft.com...[color=green]
                  > > Using convention strongly is usefull in the bounds of company, to give u
                  > > solid code understanding and improve readability.
                  > >
                  > > Conventions in artives and magazines are simplified, because author want
                  > > to
                  > > show you the gist of the code.
                  > > In your case, Address means a property, coz it's common for the properties
                  > > to start with capital letter.
                  > > We more read then type, and for this reason the usability of typing
                  > > doesn't
                  > > make sence - there are several VSIDE addings, that improve intelliscence
                  > > and
                  > > could show you either properties or methods first.
                  > > The idea to make code readable.
                  > >
                  > > Hungarian notation lost its sence due to metadates in .net - we move
                  > > mouse
                  > > over the method/property and we got description.
                  > >[color=darkred]
                  > >> Do you really think that it is helpful to use a totally different
                  > >> convetion
                  > >> to all the microsoft stuff and everything ever written in any book I have
                  > >> ever read?
                  > >>
                  > >> Just as an example: If I want the address of a person then I expect to
                  > >> find
                  > >> it named "Address" - It will probably be a property but if it's a method
                  > >> then that's cool too.
                  > >>
                  > >> So I type 'A' and there it will be in intellisense near the top of the
                  > >> list.
                  > >> How is this better than typing "prpA"?
                  > >>
                  > >> Even if somehow it does help you when you are developing your code this
                  > >> is
                  > >> irrelevant as the main aim with methods and properties is to name them in
                  > >> a
                  > >> way that is helpful to users of the class.[/color]
                  > >
                  > > --
                  > > WBR,
                  > > Michael Nemtsev :: blog: http://spaces.msn.com/laflour
                  > >
                  > > "At times one remains faithful to a cause only because its opponents do
                  > > not
                  > > cease to be insipid." (c) Friedrich Nietzsche
                  > >
                  > >[/color][/color]

                  Comment

                  • halvard.hagesaether@cmacontiki.com

                    #10
                    Re: Coding Standards

                    Obviously I didn't read all the posts in this thread before I answered,
                    otherwise I wouldn't have suggested FxCop.
                    Shame on me :)

                    Just ignore ...

                    Halvard.

                    Comment

                    • Lebesgue

                      #11
                      Re: Coding Standards

                      Jetbrains resharper will definitely improve VS.NET's intellisense a lot

                      "UJ" <fred@nowhere.c om> wrote in message
                      news:uFMOKXkMGH A.1488@TK2MSFTN GP14.phx.gbl...[color=blue]
                      > Thanks for the info.
                      >
                      > Can you suggest any of the VS IDE Add-ons that will improve intellisense?
                      >
                      > TIA - Jeff
                      >
                      > "Michael Nemtsev" <MichaelNemtsev @discussions.mi crosoft.com> wrote in
                      > message news:785CAFFF-2353-4FA8-BDA0-5581AB2D26BE@mi crosoft.com...[color=green]
                      >> Using convention strongly is usefull in the bounds of company, to give u
                      >> solid code understanding and improve readability.
                      >>
                      >> Conventions in artives and magazines are simplified, because author want
                      >> to
                      >> show you the gist of the code.
                      >> In your case, Address means a property, coz it's common for the
                      >> properties
                      >> to start with capital letter.
                      >> We more read then type, and for this reason the usability of typing
                      >> doesn't
                      >> make sence - there are several VSIDE addings, that improve intelliscence
                      >> and
                      >> could show you either properties or methods first.
                      >> The idea to make code readable.
                      >>
                      >> Hungarian notation lost its sence due to metadates in .net - we move
                      >> mouse
                      >> over the method/property and we got description.
                      >>[color=darkred]
                      >>> Do you really think that it is helpful to use a totally different
                      >>> convetion
                      >>> to all the microsoft stuff and everything ever written in any book I
                      >>> have
                      >>> ever read?
                      >>>
                      >>> Just as an example: If I want the address of a person then I expect to
                      >>> find
                      >>> it named "Address" - It will probably be a property but if it's a method
                      >>> then that's cool too.
                      >>>
                      >>> So I type 'A' and there it will be in intellisense near the top of the
                      >>> list.
                      >>> How is this better than typing "prpA"?
                      >>>
                      >>> Even if somehow it does help you when you are developing your code this
                      >>> is
                      >>> irrelevant as the main aim with methods and properties is to name them
                      >>> in a
                      >>> way that is helpful to users of the class.[/color]
                      >>
                      >> --
                      >> WBR,
                      >> Michael Nemtsev :: blog: http://spaces.msn.com/laflour
                      >>
                      >> "At times one remains faithful to a cause only because its opponents do
                      >> not
                      >> cease to be insipid." (c) Friedrich Nietzsche
                      >>
                      >>[/color]
                      >
                      >[/color]


                      Comment

                      • Michael Nemtsev

                        #12
                        Re: Coding Standards

                        See list of tools there http://www.refactoring.com/tools.html

                        ReSharper not good choose with big solutions, it's go down with even 10
                        projects in solution.
                        Im using Refactor Pro!

                        Moreover, look at code-analyzing tools, such as FixCop or .NET Test from
                        ParaSoft. They perform static analyzis of your code to check how it conforms
                        your corporate code standards. You can tune these tools for your own
                        codestandards

                        "UJ" wrote:[color=blue]
                        > Thanks for the info.
                        > Can you suggest any of the VS IDE Add-ons that will improve intellisense?
                        > TIA - Jeff[/color]
                        [color=blue][color=green]
                        > > Using convention strongly is usefull in the bounds of company, to give u
                        > > solid code understanding and improve readability.
                        > > Conventions in artives and magazines are simplified, because author want
                        > > to
                        > > show you the gist of the code.
                        > > In your case, Address means a property, coz it's common for the properties
                        > > to start with capital letter.
                        > > We more read then type, and for this reason the usability of typing
                        > > doesn't
                        > > make sence - there are several VSIDE addings, that improve intelliscence
                        > > and
                        > > could show you either properties or methods first.
                        > > The idea to make code readable.
                        > >
                        > > Hungarian notation lost its sence due to metadates in .net - we move
                        > > mouse
                        > > over the method/property and we got description.[/color][/color]

                        --
                        WBR,
                        Michael Nemtsev :: blog: http://spaces.msn.com/laflour

                        "At times one remains faithful to a cause only because its opponents do not
                        cease to be insipid." (c) Friedrich Nietzsche


                        Comment

                        Working...