Coding standards for .Net

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

    #1

    Coding standards for .Net

    I would be grateful if people in here would review my article about
    ..Net coding standards that is soon to be published by Informit.com

    It is available at http://mishj.brinkster.net/intranet/netcodingstds.doc

    I would welcome any feedback. This has been posted to VB.Net but I
    had no response there.

    Thanks
    Michelle Johnston
  • Jon Skeet

    #2
    Re: Coding standards for .Net

    mish <mishj@hotmail. com> wrote:[color=blue]
    > I would be grateful if people in here would review my article about
    > .Net coding standards that is soon to be published by Informit.com
    >
    > It is available at http://mishj.brinkster.net/intranet/netcodingstds.doc
    >
    > I would welcome any feedback. This has been posted to VB.Net but I
    > had no response there.[/color]

    First suggestion - convert it to HTML, and put it up on the web in that
    format. Significantly simpler to read!

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • guy

      #3
      Coding standards for .Net

      Generally fine, comments in *** against relevant sections

       To conserve resources, be selective in the choice of
      data type to ensure the size of a variable is not
      excessively large.
      *** but - remember integers are faster than shorts or
      bytes (and also take up the same space on the stack, but
      not in arrays - not certain of this any comments?)

       When writing classes, avoid the use of public variables.
      Instead, use procedures to provide a layer of
      encapsulation and also to allow an opportunity to validate
      value changes.
      *** Properties rather than Procedures ? ***


       Require the use Option Explicit in Visual Basic and
      VBScript to encourage forethought in the use of variables
      and to minimize errors resulting from typographical
      errors.
      *** and Option Strict ***


       Use Select Case or Switch statements in lieu of
      repetitive checking of a common variable using IfThen
      statements.
      *** normally yes but in short procedures (<32 byte) not
      neccesarily, If/Then blocks can be inlined by the Jit but
      not select/switch I believe ***

      Also ...
      It might be worth mentioning the use of underscore for
      VB.NET private instance variables eg:-

      instance variable _MyStuff
      associated property MyStuff

      otherwise fine :-)

      cheers
      guy

      Comment

      • mish

        #4
        Re: Coding standards for .Net

        Thanks Guy for your feedback! I will incorporate it into the final
        version that goes to press next week hopefully!
        Mish

        "guy" <guy_nocornedbe ef_swettenham@h otmail.com> wrote in message news:<0a2401c34 6ad$636b0370$a3 01280a@phx.gbl> ...[color=blue]
        > Generally fine, comments in *** against relevant sections
        >
        >  To conserve resources, be selective in the choice of
        > data type to ensure the size of a variable is not
        > excessively large.
        > *** but - remember integers are faster than shorts or
        > bytes (and also take up the same space on the stack, but
        > not in arrays - not certain of this any comments?)
        >
        >  When writing classes, avoid the use of public variables.
        > Instead, use procedures to provide a layer of
        > encapsulation and also to allow an opportunity to validate
        > value changes.
        > *** Properties rather than Procedures ? ***
        >
        >
        >  Require the use Option Explicit in Visual Basic and
        > VBScript to encourage forethought in the use of variables
        > and to minimize errors resulting from typographical
        > errors.
        > *** and Option Strict ***
        >
        >
        >  Use Select Case or Switch statements in lieu of
        > repetitive checking of a common variable using IfThen
        > statements.
        > *** normally yes but in short procedures (<32 byte) not
        > neccesarily, If/Then blocks can be inlined by the Jit but
        > not select/switch I believe ***
        >
        > Also ...
        > It might be worth mentioning the use of underscore for
        > VB.NET private instance variables eg:-
        >
        > instance variable _MyStuff
        > associated property MyStuff
        >
        > otherwise fine :-)
        >
        > cheers
        > guy[/color]

        Comment

        Working...