3

Let's say someone asks how to get the average of all elements in an array using javascript and someone answers with:

function getAverage(array) {
  var sum = 0;
  for (var i = 0; i < array.length; i++) {
    sum += array[i];
  }
  return sum / array.length;
}

And someone else answers with, I made a library for that (containing a link) and then posting the code:

library.average(array);

Does that answer the question or is it considered a link only answer because the algorithm to define the average is in another castle?

If that's allowed, how far can you actually go with that? If someone wants to know how to use a specific algorithm in javascript and someone writes a library just to handle that algorithm, would it be enough to share a link to that library and mention the code to solve it using the library, eg:

library.specificAlgorithm(data);

The reason I'm asking this is because you often see questions getting answered with, "you can use jQuery/Lodash/Underscore/Moment" with the relevant code to do that using the specific library and I don't think it's considered a bad answer. But then I read this answer and I'm seeing people comment that the relevant code should be posted as well.

5
  • 4
    As a side-note, the answer was copy-pasted word for word 4 times: 1 2 3 4
    – Tunaki
    May 10, 2016 at 10:51
  • @gnat Since the duplicate does not exactly answer the question, I suppose you mean it is an answer, just not a very good one? But certainly not a link only answer?
    – g00glen00b
    May 10, 2016 at 12:10
  • "See Your answer is in another castle: when is an answer not an answer? The rule-of-thumb here is to strip the markup; if you can still regard it as an (attempted) answer without the link, it is still an answer and should not be flagged..." (from duplicate)
    – gnat
    May 10, 2016 at 12:15
  • Ok, so if I post an answer like the one with library.specificAlgorithm(data); and a reference to the library, it should not be considered as a link only answer but you can downvote it or vote to flag it for VLQ?
    – g00glen00b
    May 10, 2016 at 12:47
  • Yes, it answers the question. A flag would be declined. However, it is probable that it is the wrong answer and will probably garner downvotes if that is the case. While it is fun to say "needs moar jQuery" all the time, in practice it isn't as true as it once was; and it certainly should not be the go to answer for JavaScript in general.
    – Travis J
    May 11, 2016 at 0:03

1 Answer 1

-1

I wouldn't consider a public library with only one Book a real library, same with a programming library with just one little method/use case.

Just imagine your posted your average code on your personal blog or whatever and linked to it, then it's clear that its an answer in another castle.

Simply declaring it as a library and putting it on GitHub doesn't change that fact.

To answer the Question: A library is a link-only answer if its solely purpose is to fix the questioner's problem.

If on the other hand the library, among other things, fixes the questioner's problem (like jQuery) its acceptable to just have the library's name, the specific code and a link.

2
  • 1
    But isn't that a bit weird, an answer with my "average library" would be offtopic, but if jQuery had an average method similar to that library it would be ontopic?
    – g00glen00b
    May 10, 2016 at 11:32
  • 1
    As i said, one method libs are not really a lib. In the referenced Question, the reverse-lib comes down to ~20 Lines of code the rest seems to be boiler-plate code to make it a npm-package etc.. This could have been easily posted in the answer.
    – hinneLinks
    May 10, 2016 at 12:03

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