What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

In this MySQL question, a commenter told the asker to include the full DB schema in the question body, rather than a link to sqlfiddle.

Is there a policy for use of these code sharing sites, which seem symbiotic with Stack Overflow? Is it considered good practice to include link to these sites in questions and/or answers?

I can see a lot of advantages (enforce compiling code, remove 'different environment/compiler' problems) but are there disadvantages? For example, as the commenter says, what if the sqlfiddle website is down? Is this a valid concern?

share|improve this question

1 Answer 1

Yes, this is a valid concern.

Our policy is simple: all questions and answers must be self-contained. They must include all necessary information in the body of the post, and they must continue to provide useful information even if all the links go dead. This is the Internet. Dead links are not a matter of if, but when.

Aside from that, answering a question should not require digging through a bunch of external resources. You should have acquired enough information to be able to answer the question just by reading it.

That said, there is nothing wrong with also including a link to a fiddle-style site that demonstrates the code discussed in the question/answer. Whether or not it's good practice is subjective—I don't much care about it personally, but other people really like it.

As for enforcing compilable code, I don't really see that as an important benefit or requirement. It is common that code in a question is not compilable—hence the question. And most of the code I provide in answers is intended more as an example or rough sketch. Sometimes it's more like pseudo-code, even though I applied code formatting to it. My intention is rarely to write fully-functional production code for people; I also generally exclude things like error-handling, debug checks, etc. for brevity. If you can't figure out how to make whatever minor modifications are necessary to get the example code to compile and work in your project, then you probably aren't qualified to be using it in the first place. Copy-and-paste programming is not only bad on an educational level, it presents huge security risks. I don't care to encourage it here.

share|improve this answer

You must log in to answer this question.

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