-5

My question had inline code in its first version, but it didn't really add any value, so I removed it. I then saw the requirement to add code along with a JSFiddle link.

The programming problem in my question is very simple, and I thought a few sentences would describe it clearly.

The JSFiddle example would then just provide the reader with a minimal example of my problem.

Adding mostly default JQuery Datatables code seems unnecessary.

(I would accept that my use case is quite small: asking a programming question that isn't clearly explained with some code. And I understand that questions are low quality if they have too much code as well.)

If I have a problem in my code (when someone answers my question) I promise I'll update the code snippet to be more useful.

11
  • 4
    Either 1) you think that providing a small example to demonstrate the question you've explained in words is useful to readers or 2) you don't. If 1 is true, you should be including the example in the question itself. If 2 is true, you shouldn't be linking to a JSFiddle of an example.
    – Servy
    Commented Jun 20, 2018 at 19:29
  • In my case I suspect my "small code example" is all the code. Hence the JSFiddle link. Adding all the code won't add any value (and you can't illustrate the problem completely anyway)
    – Diederik
    Commented Jun 20, 2018 at 19:43
  • 5
    @Diederik but what would happen if the fiddle was deleted or JSFiddle went offline? The question would be useless Commented Jun 20, 2018 at 19:54
  • Try posting the fiddle link without code in the question....you'll get a big red warning.
    – Paulie_D
    Commented Jun 20, 2018 at 20:00
  • @James_Parsons Unless the question contains enough information to be answered without it, in which case you can just omit it entirely. Both are possibilities.
    – Servy
    Commented Jun 20, 2018 at 20:04
  • I copied over some more code. Was working under the assumption that JSFiddle going down would make half the JS questions on StackOverflow less useful (214,658 questions contain the string)
    – Diederik
    Commented Jun 20, 2018 at 20:05
  • 2
    @Diederik If you don't think providing any code example is useful or necessary, then don't provide a code example. If you think that providing a reproducible example of the the problem you've described would be useful then include it in the question itself. Both options have situations in which they're appropriate.
    – Servy
    Commented Jun 20, 2018 at 20:06
  • @Diederik The entire reason for this behavior is to prevent that from being the case. Obviously some people will try to subvert the automatic restrictions, and there are posts posted before that mechanic was added, but it's been around for quite some time now.
    – Servy
    Commented Jun 20, 2018 at 20:07
  • @Servy I was working under the assumption that adding the code separately, in an environment where it would just run without any other overheads, would be more useful than snippets. Someone wanting to look at the behaviour in more detail can start to do what in JSFiddle. (Details like exact version of JQuery etc are captured there.) Taking it to a full dev environment from JSFiddle would be easier than from snippets IMO. However, taking all the other arguments on balance I added the code anyway.
    – Diederik
    Commented Jun 20, 2018 at 20:13
  • What exactly is the discussion point here? Either I'm to tired to get it or it's not clear enough. Commented Jun 20, 2018 at 20:41
  • @James_Parsons: The premise of this question is that the fiddle becoming unavailable is irrelevant - the question can be understood, and answered, even in the absence of whatever is beyond that link.
    – BoltClock
    Commented Jun 21, 2018 at 4:06

2 Answers 2

6

The whole point of the requirement is so that users don't have to click to go off-site just to answer your question (preventing linking to potentially unsafe domains) and so that your question never becomes unanswerable due to critical information being unavailable due to JSFiddle (or whatever site) being unavailable. JSFiddle, CodePen, etc. have gone down before more than once, so this isn't just a theoretical concern.

As for the criticism about not wanting to provide all your code or include 'overhead', don't worry about that. Stack Overflow has a rule that says questions asking about fixing problems with code requires a Minimal, Complete, Verifiable Example. They also are the ones that implemented this Stack Snippet feature, so we can assume they are willing to deal with the overhead of extra lines of code being run on their site.

If you're worried about there being too much code, then consider that the first part of the required MCVE is "Minimal". If you haven't pared your code snippet down to only the things required to reproduce the issue, then you haven't provided a Minimal code snippet as the rules require. If you have pared it down and it still seems large... that's OK; some MCVEs are 5 lines long... others reach into the triple digits. If you're simply worried about it taking up too much space on the page when reading the question, you can choose to have the Stack Snippet hidden/minimized by default so that readers can expand it themselves as desired.

3
  • 2
    It also prevents the question from becoming unhelpful if the OP fixes or changes the code on the 3rd party site where we can't roll it back. Less likely on JSFiddle than when they just link to their site but I've seen it happen.
    – BSMP
    Commented Jun 20, 2018 at 22:29
  • 2
    There's also the potential of having someone who can answer your question, but their workplace/ISP blocks jsfiddle.net (or whatever site). Just another way of being "unavailable". Commented Jun 20, 2018 at 22:33
  • Ok, and thanks for expanding some of the arguments. I did edit my question to contain a (initially hidden) code snippet. Only problem now is that running it in the StackOverflow view doesn't show the printing problem that the whole question is about. (I know, who prints websites!) So I have left the JSFiddle link in as well, as the problem can be reproduced there.
    – Diederik
    Commented Jun 21, 2018 at 5:08
3

Unfortunately, yours is quite an edge case (and one I can identify with myself). Very, very few users are good enough at writing to be able to write questions or answers that don't include boilerplate code and don't depend on code from a JSFiddle link to be answerable or useful. Furthermore, even if you can write such a post, many readers will assume that if a linked resource is unavailable, it can't be found in the post itself and freak out in the comments about it when it really isn't that big of a deal, rendering your wordsmithing efforts moot. We regularly have to decline custom flags from users about broken links too like they're the end of the world or something.

It would be extraordinarily difficult to special-case this without creating a loophole that would either be abused by users who simply aren't interested in posting good answers, or unintentionally used by users who don't know better (and one already exists: just add a code block containing garbage or even format any random word in your existing text as inline code and the quality filter will be none the wiser).

If your answer contains a link to JSFiddle, it doesn't matter even if the rest of your non-code answer is written in such a way as to make the link non-essential; you need to include code in some form. That's just the way it is. The only other alternative is to not include the link at all if it is that non-essential. Remember that you can embed runnable (and collapsible) Stack Snippets that don't require readers to leave the page at all, if you do still want to include a runnable demo.

1
  • 1
    I fully accept that my case is a corner case, and that adding the code to the question itself is not that much overhead. If I can make a suggestion perhaps: the "Please add code" popup for JSFiddle links, should also contain a sentence about the embedded code alternative that SO hosts? I have seen it around, but didn't realise it was as native as in the question control. Figured it out now though when I added a snippet to my question.
    – Diederik
    Commented Jun 21, 2018 at 5:12

You must log in to answer this question.

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