26
\$\begingroup\$

The odds of someone submitting a massive amount of code seems likely on this type of site. Whether or not this is permitted is the first hurdle. If it is permitted, then offloading the code to a pastebin might be question number two. If that is suggested, then should there be an official pastebin? Perhaps we could have one created specifically for stackexchange?

\$\endgroup\$
5
  • 2
    \$\begingroup\$ That would really be a great feature -- then we could be sure about no data being lost either (and posts are tied to your account so you get minus rep for spamming. ;) \$\endgroup\$
    – Zolomon
    Jan 19, 2011 at 21:27
  • \$\begingroup\$ Forgive my ignorance, is there a simple definition of "pastebin"? \$\endgroup\$
    – LRE
    Jan 19, 2011 at 21:33
  • \$\begingroup\$ In answer to my own comment question: en.wikipedia.org/wiki/Pastebin \$\endgroup\$
    – LRE
    Jan 19, 2011 at 21:34
  • 1
    \$\begingroup\$ Added the tag feature-request, actually think that it would be nice to have an official pastebin. \$\endgroup\$
    – Zolomon
    Jan 19, 2011 at 21:47
  • \$\begingroup\$ I'll go ahead and throw out my nomination for diffpaste.com in case we do go down the external code hosting route. \$\endgroup\$
    – BenV
    Jan 19, 2011 at 22:01

6 Answers 6

21
\$\begingroup\$

I think it's better to include the code in the post if possible. Some people will not follow links to look at the code. Also, moving the code to a different site makes it harder for people to find the questions from search engines.

I can think of two potential downfalls to including the code in the actual question:

1. Lots of scrolling required for long pieces of code
If this is an issue the first step should always be to ask the OP to remove code not relevant to the question, like what has already been done here. This will make it easier for potential answerers to understand the issue, and will also improve search engine accuracy.

2. Line numbers
Currently there's no option to display line numbers in code snippets. I think we should revive this discussion on meta.SO to see if the SOIS team will consider adding this feature before we jump to an external code hosting site.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ +1: Definitely a few problems to take into account... \$\endgroup\$
    – ircmaxell
    Jan 19, 2011 at 21:58
  • \$\begingroup\$ maybe a small modification so that when viewing a post, if the code block is over 100 lines long, the latter portion gets snipped and replaced with a link, to open the post within a new window to see the post alone. \$\endgroup\$
    – RobertPitt
    Jan 19, 2011 at 23:55
13
\$\begingroup\$

I'd say pastebins should be avoided. Some of us can't get to them due to firewalls at work, and it really ruins the continuity of the site. I'd expect everything to be here, so we aren't dependent upon some third party resource going away.

\$\endgroup\$
10
\$\begingroup\$

I think the usage of a Pastebin should be discouraged. The problem is that they typically expire (most are 1, 7, or 30 days IIRC). At which point the post on this board become basically useless for future reference.

\$\endgroup\$
4
\$\begingroup\$

I think large-ish amounts of code is pretty essential for this site to work. But already there's a question posted with a fairly large chunk of code that's difficult to digest because of all the scrolling required to see it. That's definitely a problem. My reactions are: First, a guideline will have to be established for how much code is too much code; second, there needs a better way to display large-ish amounts of code so that its easier to read. I have no experience with pastebins (never even heard of them until reading this thread) so I have no idea if they would help or not.

\$\endgroup\$
2
  • \$\begingroup\$ To be fair, the (justifiably) most upvoted comment on the linked code is "It's too long, break it up into multiple methods". \$\endgroup\$
    – Inaimathi
    Jan 20, 2011 at 14:58
  • \$\begingroup\$ Yeah, that's a totally valid point. Still, I think questions here should accommodate larger quantities of code that you'd typically see on stackoverflow, for example. \$\endgroup\$ Jan 20, 2011 at 23:56
3
\$\begingroup\$

Plenty exist now: http://en.wikipedia.org/wiki/Comparison_of_pastebins, though I've not taken the time to actually look through any of these.

\$\endgroup\$
2
\$\begingroup\$

Look into gist from github

https://gist.github.com/

See my trivial example here: https://gist.github.com/786968

With line numbers too. And it'll never expire unless I delete it.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ while it won't ever expire according to GitHub right now, our SE overlords won't trust that (and neither will I). The content of a site should never need to depend on any site but this one working. If github were to suddenly shutdown, then every post using its paste-bin would be useless. \$\endgroup\$
    – Wade Tandy
    Jan 19, 2011 at 22:25
  • \$\begingroup\$ good point. So does the markdown in SE add line numbers,etc? I've never seen it do that and that would be required for this type of site to be useable (if the user is uploading numerous lines of code for review). \$\endgroup\$
    – cbrulak
    Jan 19, 2011 at 22:28
  • \$\begingroup\$ nope, see my answer above. \$\endgroup\$
    – BenV
    Jan 19, 2011 at 23:33

You must log in to answer this question.

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