473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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?

Jun 27 '08 #1
8 1222
On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglobal.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]
Jun 27 '08 #2
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.
Jun 27 '08 #3
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_newsgroups" <ro********@yahoo.comwrote in message
news:48**********************************@c65g2000 hsa.googlegroups.com...
On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglobal.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]

Jun 27 '08 #4
On Jun 11, 8:37 am, "Andy B" <a_bo...@sbcglobal.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_newsgroups" <rowe_em...@yahoo.comwrote in message

news:48**********************************@c65g2000 hsa.googlegroups.com...
On Jun 11, 7:36 am, "Andy B" <a_bo...@sbcglobal.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:

http://www.yoda.arachsys.com/csharp/complete.html

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]
Jun 27 '08 #5
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.AspNet 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
Jun 27 '08 #6
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.AspNet newsgroups in more languages including English,
the right places to ask about ASP.Net controls.
This is the newsgroup I was talking about
(microsoft.public.dotnet.framework.aspnet):

http://groups.google.com/group/micro...lnk=li&safe=on
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:

http://groups.google.com/group/micro...13d2813d77e643

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

Jun 27 '08 #7
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

Jun 27 '08 #8
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]

Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: srinivas | last post by:
hey can u tell me the rules of making a data flow diagram,i need to draw these in my project,i have studied it before but i am not able to understand it properly,can u please make it clear for me,i...
27
by: Stuart Gerchick | last post by:
C++ Coding Standards : 101 Rules, Guidelines, and Best Practices by Herb Sutter, Andrei Alexandrescu is now a month or so away from release. What is people's opinion on this...is it going to be a...
0
by: vcp | last post by:
<xml newbie> Hi all, We are considering using XML to specify rules, policies. This XML file will be used to generate source code in either managed C++ or C#, which will be implemention of API...
1
by: Dalan | last post by:
For some apparent reason I have been unable to structure a piece of code on the BeforeUpdate event on a form that has 3 fields which I need to set validation rules. I would appreciate anyone's...
1
by: Mike Heden | last post by:
What are the rules regarding the linking fields between a form and subform? Does the field on the main form *have* to be based on a primary key? Most examples seem to quote the use of a primary...
6
by: hdante | last post by:
Out of curiosity, where are the group rules ? I ask so, because people are usually dismissed, by saying that something "is not standard". Thanks, Henrique Dante de Almeida
3
by: Alex Maghen | last post by:
Hi I have three questions about the Tab Order that's rendered by default on an ASPX page: 1. On a page that's all ordered HTML (instead of absolute positioning), shouldn't the default be that...
5
by: sck10 | last post by:
Hello, I need to create a Business Rules table that can be pulled into the web page and use it as criteria for who should receive the approval email. For example, I have created a travel...
2
by: J055 | last post by:
Hi I'm adding rules dynamically to the HtmlHead.StyleSheet using the CreateStyleRule method. I'd like to know how to check whether the rules already exist first. Thanks Andrew
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.