c# Coding guidelines & conventions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jarit@xs4all.nl

    c# Coding guidelines & conventions

    Hi,

    Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
    PL/SQL, T-SQL, VB and VBScript.

    Well written and free to download.



    Jeroen

  • Jon Skeet [C# MVP]

    #2
    Re: c# Coding guidelines & conventions

    <jarit@xs4all.n l> wrote:[color=blue]
    > Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
    > PL/SQL, T-SQL, VB and VBScript.
    >
    > Well written and free to download.[/color]

    Though not free to use in a commercial setting.
    [color=blue]
    > www.demachina.com/products/swat[/color]

    There seems to be very little actual *useful* C# stuff in there though.

    The author seems unaware of the "using" statement, and doesn't roll
    back failed transactions (or dispose of them, despite saying just a
    page earlier that you shouldn't forget to call Dispose). Frequent
    examples catching bare Exception aren't encouraging either.

    I would also have liked to see

    if (x)
    y;

    avoided in favour of

    if (x)
    {
    y;
    }

    In short, I certainly wouldn't pay $99 for the privilege of using these
    in a commercial setting.

    (By the way Jeroen, you're not the same Jeroen who appears to be one of
    the authors of the document, are you? After all, you then couldn't
    honestly say you'd "found" these coding guidelines.)

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

    • Sean Hederman

      #3
      Re: c# Coding guidelines &amp; conventions

      <jarit@xs4all.n l> wrote in message
      news:1116724740 .939072.49510@g 43g2000cwa.goog legroups.com...[color=blue]
      > Hi,
      >
      > Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
      > PL/SQL, T-SQL, VB and VBScript.
      >
      > Well written and free to download.
      >
      > www.demachina.com/products/swat[/color]

      I enjoyed the statement "Follow the simple guidelines described in this
      document and you won't encounter a single problem ever. Promise"

      Yeah sure, all bugs can be traced to sloppy coding conventions.


      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: c# Coding guidelines &amp; conventions

        <jarit@xs4all.n l> wrote:[color=blue]
        > Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
        > PL/SQL, T-SQL, VB and VBScript.
        >
        > Well written and free to download.
        >
        > www.demachina.com/products/swat[/color]

        Oh, I've only just looked at the Java section. The string concatenation
        section is a real laugh, showing that the author really doesn't know
        Java particularly well. While it's a good idea to use a StringBuffer
        when concatenating strings in a loop (or with other temporary copies),
        the code example given is just a less readable version of the code
        which the compiler would have generated for

        return "The value of "+name+" is "+val;

        (In fact, with Java 1.5, the latter would be *faster*, as it will
        automatically use StringBuilder rather than StringBuffer.)


        Specifying that reflection just shouldn't be used is foolish - there
        are lots of places where it makes perfect sense to use it. It shouldn't
        be *overused*, but that's a different matter.


        Suggesting the direct use of Log4j but talking about this being
        reviewed in the long term is foolish when the Commons Logging project
        allows you to use common logging code which will then use whatever
        logging implementation you want underneath. Saying that debug logging
        isn't very granular suggests a lack of understanding of Log4j - you can
        very easily turn debug logging on just for one class, assuming you
        choose your logging categories appropriately. (Calling Logger.getLogge r
        with the *name* of the class rather than the class itself is also
        somewhat odd.)

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

        • Jon Skeet [C# MVP]

          #5
          Re: c# Coding guidelines &amp; conventions

          <jarit@xs4all.n l> wrote:[color=blue]
          > Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
          > PL/SQL, T-SQL, VB and VBScript.
          >
          > Well written and free to download.
          >
          > www.demachina.com/products/swat[/color]

          Oh, just found another amusing bit - the HTML guidelines.

          Immediately following a section talking about standlone HTML pages
          having a long comment at the start, it says to make sure that the HTML
          is optimised, and to remove excess tags. What, you mean like a large
          comment?

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

          • Umer Hanif Sheikh

            #6
            RE: c# Coding guidelines &amp; conventions

            I really like the microsoft patterns and practices, they are really very
            useful for stuff like optimizing perf and best practices for data access and
            stuff. They are must for every developer starting to develop for the .NET
            Framework.

            "jarit@xs4all.n l" wrote:
            [color=blue]
            > Hi,
            >
            > Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
            > PL/SQL, T-SQL, VB and VBScript.
            >
            > Well written and free to download.
            >
            > www.demachina.com/products/swat
            >
            > Jeroen
            >
            >[/color]

            Comment

            • Mark Rance

              #7
              Re: c# Coding guidelines &amp; conventions


              "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
              news:MPG.1cfa2d 927f9736c698c17 1@msnews.micros oft.com...[color=blue]
              > <jarit@xs4all.n l> wrote:[/color]
              [color=blue]
              > I would also have liked to see
              >
              > if (x)
              > y;
              >
              > avoided in favour of
              >
              > if (x)
              > {
              > y;
              > }[/color]


              Not me. I hate braces placed unnecessarily around single stmt blocks.

              -Mark


              Comment

              • Joerg Jooss

                #8
                Re: c# Coding guidelines &amp; conventions

                Jon Skeet [C# MVP] wrote:
                [color=blue]
                > Suggesting the direct use of Log4j but talking about this being
                > reviewed in the long term is foolish when the Commons Logging project
                > allows you to use common logging code which will then use whatever
                > logging implementation you want underneath.[/color]

                Slightly OT remark: Commons Logging lacks MDCs and NDCs, which are
                quite useful for certain types of applications.

                (I'll suppress my urge to whine about Commons Logging classloading
                issues here ;->)

                We're now switching back to our C# program...

                Cheers,

                --

                mailto:news-reply@joergjoos s.de

                Comment

                Working...