10

Is there an agreed way to deal with answers which assume the use of third party programming libraries when none has been specified?

For example, the answers to many JavaScript questions assume the use of "jQuery", even if the asker has not specified that they're using that library.

Is it acceptable to downvote such answers, or ask the answerer to change their answer so it does not assume unspecified programming libraries?

2
  • Add the missing tag and move on.
    – Knu
    Commented Mar 7, 2016 at 6:45
  • 17
    Don't add tags based on answers. If someone posts an answer which requires the inclusion of an entire library, then that is not a case of a missing tag; it is the case of an off topic answer and as BoltClock alludes to it is potentially utterly useless.
    – Travis J
    Commented Mar 7, 2016 at 7:26

2 Answers 2

12

It always helps to be explicit. If it turns out that the asker or someone else reading that answer is not using said library, then the answer becomes utterly useless and the reader has just wasted their time on it. And someone who isn't familiar with the library at all might get confused when they drop it into their own project and find that it doesn't work.

For example, if a question asks how to manipulate the DOM in a script, providing a snippet either using native DOM API calls, or worse, another library, and you go

Try:

$('#foo').appendTo('#bar');

All you're going to do is confuse the asker, and anyone else looking for an answer to the question who isn't already using jQuery:

  • "Doesn't work, I get ReferenceError: $ is not defined"
  • "What language is this?"
  • "Who said I was using jQuery?"

And you're just going to embarrass yourself.

Even a simple preface of "This is possible with jQuery" would be enough to prevent any of this confusion, though if the asker explicitly says that using jQuery is not possible then such an answer would not be useful either way — in that case, downvoting it is the best choice.

1
  • 5
    "Try" - shudders.
    – CodeCaster
    Commented Apr 20, 2016 at 15:43
8

If the question explicitly states that answers should not involve that library, or libraries in general, then the answer is not a valid answer and should be downvoted.

If the answer does not explicitly state that the answer uses a 3rd party library (or it is otherwise not immediately obvious that this is the case), then the answer is incomplete and should either be edited or downvoted.

Otherwise... it's dealer's choice, really. Some would say that solving a problem by employing a widely available and popular library is a perfectly valid answer. Others might say that if the asker was using a particular library, they'd have mentioned it, so it's rude to suggest that they use something they may not wish to.

Personally, unless the library was really obscure, outdated, requires loads of dependencies, or unquestionably terrible, I wouldn't downvote for it. Even if it isn't helpful to the OP, the answer can still help someone else with that problem who does use the library.

You must log in to answer this question.

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