Rules for Posting code

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

    Rules for Posting code

    Before I do a no no on a newsgroup, I need to ask a question: What is the
    max number of lines of code you can/should post here before it gets too
    long?



  • rowe_newsgroups

    #2
    Re: Rules for Posting code

    On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglo bal.netwrote:
    Before I do a no no on a newsgroup, I need to ask a question: What is the
    max number of lines of code you can/should post here before it gets too
    long?
    In my opinion if you are posting a question you should limit it the
    the fewest lines of code that demonstrate the problem. Often times you
    can pull out the extraneous actions and show only the ones that are
    causing the problem. What you need to remember is that most people
    here are not going to copy and paste your code into Visual Studio and
    manually run through and try to find the problem. Most of us will
    probably just read the code and offer what feedback we can. With that
    said you want to keep it as simple as possible so when we browse
    through the code we can mentally track what is going on. In my
    opinion, I wouldn't recommend posting a question with code that has
    more than 20 lines and a Cyclomatic Complexity (holy cow, was that a
    college word I just used?) more than 6 or 7. Anything more and it'll
    be hard to find what the problem is just by looking at the code.

    However when it comes to posting a code sample in response to a
    question the rules change. As far as I'm concerned if you are posting
    code to help someone you should not skimp on what you provide. It
    doesn't need to be a full fledged working sample tailored just for the
    poster, I usually just post the pieces that are needed to get the
    poster back on track, but I leave the "standard" bits and replace them
    with comments on what needs to go there.

    One other thing I learned long ago is to put your code in
    distinguishing blocks to separate them from the rest of the code. The
    model I follow (which was inspired by Herfried Wagner) is to put code
    snippets in blocks like so:

    /////////////////
    Public Sub foo()
    '// Do something cool
    End Sub
    /////////////////

    Anyways, I'm not sure I answered your exact question, but its really
    just a judgment call on your end. The worst thing that can happen is
    that your post will be ignored because it will be too much work to
    read through a huge code sample. That's probably the most important
    thing to realize, the longer and more complex your post, the lesser
    chance it will be answered.

    Thanks,

    Seth Rowe [MVP]

    Comment

    • Phill W.

      #3
      Re: Rules for Posting code

      Andy B wrote:
      Before I do a no no on a newsgroup, I need to ask a question: What is the
      max number of lines of code you can/should post here before it gets too
      long?
      Just focus on a /specific/ problem or idea in a single thread and then,
      basically:

      "Start at the Beginning, go on until the End, and then stop".

      Regards,
      Phill W.

      Comment

      • Andy B

        #4
        Re: Rules for Posting code

        Ok. Kind of answers the question. At least I know better how to try and deal
        with things on that now...

        I asked because I am having a problem with an asp.net wizard control and
        some code to run one of the WizardSteps. I have to determine if I can, where
        the particular problem(s) are at and then figure out how to copy the code
        out and put it here. It's hard in this example, because the 10 or so lines
        of code that might be the problem depends on the result of 40 other lines of
        code. Is it uncommon to create a dummy application and try to reproduce the
        code giving the problem with simpler code and post that dummy code if it
        causes the same issues?


        "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
        news:48b744d1-db36-455a-b248-ff3e11e9db08@c6 5g2000hsa.googl egroups.com...
        On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglo bal.netwrote:
        >Before I do a no no on a newsgroup, I need to ask a question: What is the
        >max number of lines of code you can/should post here before it gets too
        >long?
        >
        In my opinion if you are posting a question you should limit it the
        the fewest lines of code that demonstrate the problem. Often times you
        can pull out the extraneous actions and show only the ones that are
        causing the problem. What you need to remember is that most people
        here are not going to copy and paste your code into Visual Studio and
        manually run through and try to find the problem. Most of us will
        probably just read the code and offer what feedback we can. With that
        said you want to keep it as simple as possible so when we browse
        through the code we can mentally track what is going on. In my
        opinion, I wouldn't recommend posting a question with code that has
        more than 20 lines and a Cyclomatic Complexity (holy cow, was that a
        college word I just used?) more than 6 or 7. Anything more and it'll
        be hard to find what the problem is just by looking at the code.
        >
        However when it comes to posting a code sample in response to a
        question the rules change. As far as I'm concerned if you are posting
        code to help someone you should not skimp on what you provide. It
        doesn't need to be a full fledged working sample tailored just for the
        poster, I usually just post the pieces that are needed to get the
        poster back on track, but I leave the "standard" bits and replace them
        with comments on what needs to go there.
        >
        One other thing I learned long ago is to put your code in
        distinguishing blocks to separate them from the rest of the code. The
        model I follow (which was inspired by Herfried Wagner) is to put code
        snippets in blocks like so:
        >
        /////////////////
        Public Sub foo()
        '// Do something cool
        End Sub
        /////////////////
        >
        Anyways, I'm not sure I answered your exact question, but its really
        just a judgment call on your end. The worst thing that can happen is
        that your post will be ignored because it will be too much work to
        read through a huge code sample. That's probably the most important
        thing to realize, the longer and more complex your post, the lesser
        chance it will be answered.
        >
        Thanks,
        >
        Seth Rowe [MVP]

        Comment

        • rowe_newsgroups

          #5
          Re: Rules for Posting code

          On Jun 11, 8:37 am, "Andy B" <a_bo...@sbcglo bal.netwrote:
          Ok. Kind of answers the question. At least I know better how to try and deal
          with things on that now...
          >
          I asked because I am having a problem with an asp.net wizard control and
          some code to run one of the WizardSteps. I have to determine if I can, where
          the particular problem(s) are at and then figure out how to copy the code
          out and put it here. It's hard in this example, because the 10 or so lines
          of code that might be the problem depends on the result of 40 other lines of
          code. Is it uncommon to create a dummy application and try to reproduce the
          code giving the problem with simpler code and post that dummy code if it
          causes the same issues?
          >
          "rowe_newsgroup s" <rowe_em...@yah oo.comwrote in message
          >
          news:48b744d1-db36-455a-b248-ff3e11e9db08@c6 5g2000hsa.googl egroups.com...
          >
          On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglo bal.netwrote:
          Before I do a no no on a newsgroup, I need to ask a question: What is the
          max number of lines of code you can/should post here before it gets too
          long?
          >
          In my opinion if you are posting a question you should limit it the
          the fewest lines of code that demonstrate the problem. Often times you
          can pull out the extraneous actions and show only the ones that are
          causing the problem. What you need to remember is that most people
          here are not going to copy and paste your code into Visual Studio and
          manually run through and try to find the problem. Most of us will
          probably just read the code and offer what feedback we can. With that
          said you want to keep it as simple as possible so when we browse
          through the code we can mentally track what is going on. In my
          opinion, I wouldn't recommend posting a question with code that has
          more than 20 lines and a Cyclomatic Complexity (holy cow, was that a
          college word I just used?) more than 6 or 7. Anything more and it'll
          be hard to find what the problem is just by looking at the code.
          >
          However when it comes to posting a code sample in response to a
          question the rules change. As far as I'm concerned if you are posting
          code to help someone you should not skimp on what you provide. It
          doesn't need to be a full fledged working sample tailored just for the
          poster, I usually just post the pieces that are needed to get the
          poster back on track, but I leave the "standard" bits and replace them
          with comments on what needs to go there.
          >
          One other thing I learned long ago is to put your code in
          distinguishing blocks to separate them from the rest of the code. The
          model I follow (which was inspired by Herfried Wagner) is to put code
          snippets in blocks like so:
          >
          /////////////////
          Public Sub foo()
          '// Do something cool
          End Sub
          /////////////////
          >
          Anyways, I'm not sure I answered your exact question, but its really
          just a judgment call on your end. The worst thing that can happen is
          that your post will be ignored because it will be too much work to
          read through a huge code sample. That's probably the most important
          thing to realize, the longer and more complex your post, the lesser
          chance it will be answered.
          >
          Thanks,
          >
          Seth Rowe [MVP]
          Jon Skeet's article would probably describe what you should do better
          than I could do it:



          Also be sure to post your question to the ASP.NET newsgroup - you are
          much more likely to receive an answer there than in this group if you
          are asking about an ASP.NET control.

          Thanks,

          Seth Rowe [MVP]

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: Rules for Posting code

            Seth-

            snip
            Also be sure to post your question to the ASP.NET newsgroup - you are
            much more likely to receive an answer there than in this group if you
            are asking about an ASP.NET control.
            >
            snip

            You are right in this, however there is no ASP.NET newsgroup. (As you don't
            mean the Spanish or French one).

            There are FrameWork.AspNe t newsgroups in more languages including English,
            the right places to ask about ASP.Net controls.

            However, I am curious why you wrote this message as I could not find the
            about ASP.Net controls in the messages from Andy.

            By the way, I thougth that the by Herfried's used convention was

            \\\
            Code as I do it mostly as well,
            ///

            I don't know why, but as Herfried asks this I do it, I thougth that it has
            to do with his little hamser.

            -Cor


            Comment

            • rowe_newsgroups

              #7
              Re: Rules for Posting code

              You are right in this, however there is no ASP.NET newsgroup. (As you don't
              mean the Spanish or French one).
              >
              There are FrameWork.AspNe t newsgroups in more languages including English,
              the right places to ask about ASP.Net controls.
              This is the newsgroup I was talking about
              (microsoft.publ ic.dotnet.frame work.aspnet):


              However, I am curious why you wrote this message as I could not find the
              about ASP.Net controls in the messages from Andy.
              Second sentence:



              "I asked because I am having a problem with an asp.net wizard control"
              By the way, I thougth that the by Herfried's used convention was
              Yeah it is, I put that mine was inspired by his, I prefer the repeated
              forward slashes over his style.
              I don't know why, but as Herfried asks this I do it, I thougth that it has
              to do with his little hamser.
              What's a hamser?

              Thanks,

              Seth Rowe [MVP]

              Comment

              • Cor Ligthert[MVP]

                #8
                Re: Rules for Posting code

                Seth,

                snip
                >I don't know why, but as Herfried asks this I do it, I thougth that it
                >has
                >to do with his little hamser.
                >
                What's a hamser?
                >
                It was a typo, it should have been hamster, I thought it has in English,
                German and Dutch the same name, but is too the name of an newsreader that
                Herfried uses/used.

                :-)

                Cor

                Comment

                • rowe_newsgroups

                  #9
                  Re: Rules for Posting code

                  It was a typo, it should have been hamster, I thought it has in English,
                  German and Dutch the same name, but is too the name of an newsreader that
                  Herfried uses/used.
                  That makes soooo much more sense now!

                  :-)

                  Thanks,

                  Seth Rowe [MVP]

                  Comment

                  Working...