Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

For long code, what should I do?

  1. write down all the code in body content
  2. Parse the snippet and link the rest of it using pastebin
  3. post the pastebin URL only.

And, how long is long?

share|improve this question

If you feel you need that much code to ask a question, the question is probably wrong. Or, at least, a bad fit for Stack Overflow.

share|improve this answer
I can take conclusion that the better solution / question is, to give short snippet and post the long one on pastebin. – ariefbayu Nov 2 '09 at 6:47
yes, that is a good compromise -- show the relevant bits and put the rest behind a link. – Jeff Atwood Nov 2 '09 at 7:49

Ideally you should make it short enough to fit in the normal question length. I've yet to see a good reason for more than about 80 lines of source in a question on SO.

share|improve this answer

You should keep the code to the minimum capable to explain your inquiry/problem.

In my experience, more than 100 lines is too much.

You should always try to post the smallest possible code showing the problem.

share|improve this answer

It is better to just include the important lines in your code; however, sometimes you can't realize that other parts of the code are relevant too. So, in same cases is good to include the whole code. For that reason I think Stack Overflow should have the option to include an option to attach code in files, or maybe a pastebin like solution.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .