57

Recently, I came across this question asking about collecting a list into sublists in Scheme. The OP received a very comprehensive answer, which was accepted.

However, another answer was posted in a completely different language, Java. In my opinion, this is completely ridiculous for a number of reasons.

  • The OP explicitly listed language requirements in the question.

    Also this has to be a single pass function without any helpers in ISL+.

  • Racket uses immutable lists, but the Java solution uses mutable ArrayLists, so the algorithm isn't even comparable.

  • What's more, the OP has proposed a very specific set of requirements that restrict the solution so that an implementation in another language is effectively meaningless.


I asked about this question on the Tavern on the Meta. Here were my musings:

I... don't even know how to handle this. Does this qualify as NAA?
It certainly seems to fit the bill to me.
"Your answer is in another castle."

Followed by Jason C's response:

Lol... it's in another game entirely.

I didn't (and still don't) think this qualifies as an answer. This doesn't help the asker, and it isn't even going to help anyone else, either. So, after that line of reasoning, I decided to flag as "not an answer".

But no, it would seem my flag was disputed by the moderator who reviewed my flag.

flags should not be used to indicate technical inaccuracies, or an altogether wrong answer

So, what is the consensus here? Is this a valid answer that should just be downvoted (which I did)? Or should it be removed? I've stated my opinion, but I'd like to hear any counterarguments.

16
  • 14
    That answer is not very helpful, but I think that there's an attempt to answer, so I wouldn't flag it as NAA personally. It's in the wrong language, it's mostly useless, but it's actually trying to solve the original question in a contrived way. Downvotes seem to have handled it perfectly well.
    – tux3
    Commented Apr 12, 2015 at 23:34
  • 13
    @tux3 A link with no context is an attempt to answer, too, but I don't think it fits the site's definition of "an answer". Commented Apr 12, 2015 at 23:35
  • 2
    Right. But there's no close reason for "this answer if unhelpful and missing the point". A link only answer is very low quality and should be removed if it's not editable into a good answer, but it's not NAA.
    – tux3
    Commented Apr 12, 2015 at 23:39
  • 3
    @tux3 I think Shog would disagree with you. Commented Apr 12, 2015 at 23:40
  • I agree that "You should take the tutorial here" is NAA, I was thinking about "You should do {X} click here for more info", which has a bit more potential. Back to your answer, there's no doubt that it's unhelpful, but the actual algorithm is there.
    – tux3
    Commented Apr 12, 2015 at 23:41
  • 2
    The problem I have with flagging this as NAA is where would you draw the line? At what point does an answer have to be so far off the mark that you'd flag it NAA? What's the objective metric there, and why not let downvotes take care of it?
    – tux3
    Commented Apr 12, 2015 at 23:46
  • An average mod probably reviews like 12,000 posts an hour. Maybe he/she didn't read the whole question. (12000 posts/hour = .3 sec/post)
    – jkd
    Commented Apr 13, 2015 at 0:44
  • 7
    Not an answer means 'not an answer'. It is an answer, albeit a not very relevant one. Mods aren't programming specialists on every language they encounter, so leave the 'wrong' to downvotes, and the cleanup flagging for anything that specifically warrants it.
    – Sobrique
    Commented Apr 13, 2015 at 11:27
  • 2
    @Sobrique Yes, that is exactly right. This does appear to be an answer so choosing NAA as a flag is incorrect.
    – Taryn Mod
    Commented Apr 13, 2015 at 13:32
  • 4
    It's an answer; it just isn't an answer to the question that was asked.
    – KSFT
    Commented Apr 15, 2015 at 12:04
  • 1
    This should have been in the moderators questionarie.
    – Braiam
    Commented Apr 15, 2015 at 12:53
  • @KSFT In that case I could go around posting the answer "The elephant is blue" everywhere. I'm sure that's the answer to some question. ;-) Commented Apr 15, 2015 at 15:07
  • 2
    @blalasaadri Yeah, if that's the rule, I guess you could; that's why I don't agree with that rule.
    – KSFT
    Commented Apr 15, 2015 at 15:12
  • 1
    The flag description says "attempt to answer the question". I assume "the question" refers to the one it was posted as an answer to. If that's true, then the flag was valid, because the code in Java does not answer the question about Scheme.
    – KSFT
    Commented Apr 15, 2015 at 15:18
  • 4
    Possible duplicate of How should we handle answers in a programming language other than what the OP requested?
    – jww
    Commented Aug 17, 2018 at 5:27

6 Answers 6

48

Completely useless, for the same reason I also advocate that duplicates should not target other languages.

The OP isn't likely helped by this and neither are future visitors. That being said: the NAA flag is correct but not appropriate. The moderator that handles your flag sees a code answer and while the "Solution to this in Java" should have been an indication, I don't expect moderators to investigate this flag any further. What I would have done is create a custom flag and explain it so they have the necessary context.

Language tags exist for a reason. If we start accepting different languages on a question then what's the point?

6
  • 10
    God forbid you have to know more than 1. Commented Apr 12, 2015 at 23:50
  • 26
    An answer in an unrelated (and unrequested) language is not an answer and should be handled as such. But it may not be obvious enough to flag as NAA unless you are lucky to get a mod who knows either/both languages. Commented Apr 12, 2015 at 23:52
  • 1
    Looks like the answer has since been nuked. I'll raise custom flags for this sort of thing in the future. Commented Apr 13, 2015 at 15:44
  • 2
    @AlexisKing: No, don't do that. A custom flag may be more correct than a NAA flag, but it still takes up time the moderators don't have. Just downvote it and leave a comment explaining that the answer is wrong because it's in the wrong language.
    – Alan Moore
    Commented Apr 15, 2015 at 12:51
  • @AlanMoore: Better, downvote it and leave a comment explaining that the answer is wrong because the idea is inapplicable to immutable data structures. An answer in a different language is often very useful, as long as the idea it expresses actually solves the problem. The issue is not the language, it's that the problem being solved is irreconcilably different.
    – Ben Voigt
    Commented Apr 23, 2015 at 19:16
  • "If we start accepting different languages on a question then what's the point?" -- it depends on the question. In the immediate example above, and in the question you answered on MSE, I agree that these are not appropriate scenarios for mixing languages, as the questions are indeed specific to the language in question. But so many questions have nothing to do with the language being used, and instead involve only issues in the framework being used; a framework that is usable via any number of languages. Why should good answers that happen simply to use a different language be rejected? Commented Nov 28, 2015 at 20:20
48

Voting would be the correct response in this case. Flags should only be used for exceptional situations such as a post that doesn't attempt any answer, or spam. The answer is an answer, it's just not a very useful one. Vote accordingly:

enter image description here

The NAA flag is very commonly used for anything from spam to comments and maliciously by people who disagree with the answer. It is handled by mods and other users who may or may not have domain specific knowledge. Often, the default course of action is to simply ignore the flag, since the post appears to be an answer.

Since NAA is problematic and no other flag really fits the situation, your only remaining choice is the custom flag. For a custom flag, you'd have to explain what the issue is and then wait for a diamond mod who has the required expertise to judge whether or not you're right. But diamond mods are really busy, and this is really trivial.

Throw a few downvotes at a post, and most users will simply self-delete. It's a much more effective strategy and definitely wins in the long run, because even if it doesn't get deleted, visitors to the site will see the negative post score and know to ignore it. (Like any system, this approach is not perfect and has flaws, but what'cha gonna do?)

For a really long discourse of the problems with the NAA flag, see this post:

A minor change to the description of the "not an answer" flag: "the question" → "a question"

4
  • 6
    I don't know why this answer has so many downvotes. Maybe people are trying to prove a point? I agree with you and Alexis King and tux3 from the comments on the question. The posted response was an attempt to answer the question, and voting should show that the answer is not a useful one. Commented Apr 13, 2015 at 1:58
  • 2
    Probably because the original revision of the answer merely said "Vote, don't flag."
    – Robert Harvey Mod
    Commented Apr 13, 2015 at 2:18
  • 1
    Yep, that's all I had time for at that point. Came back and elaborated. Don't really care though... it's a democracy.
    – JDB
    Commented Apr 13, 2015 at 2:19
  • 3
    Hᴏᴡ is a post that's completely irrelevant to the question considered an answer? Are you saying that if you ask "What's 1+1?" and I answer "Blue", then that's a valid answer that deserves to remain here for all time, taking up space, and confusing others, unless I choose to self-delete? Maybe a better comparison, what if I answer in a language that you don't understand? My answer could be 三 or ثلا‎
    – ashleedawg
    Commented Apr 25, 2018 at 6:04
19

In this specific case, the answer isn't particularly useful hence legimitatelly downvotable, but...

Let's not generalize too hastily. It's case by case.

Sometimes an answer in a different programming language is useful, even when the question is tagged with a specific language.

Heck, sometimes even an answer in a fictional programming language a.k.a. pseudocode can be very useful. If pseudocode is OK in those cases, then a different, real language is also OK. (Who says it isn't pseudocode?)

It depends whether the question is mostly about:

  • the logic — in which case pseudocode can be useful, or
  • a feature specific to the tagged programming language — in which case an answer in a different programming language is plainly irrelevant.

There's a bit of a continuum between the two (and perhaps other elements to consider as well). Let's make sure to use our judgement to determine when an answer in a different programming language is useful and when it isn't.

1
7

In general it is indeed useless to give an answer in a different language, and thus should such an answer be voted down.

The only exception that I have encountered several times is when there seems to be a difference between what the asker wants and what the asker needs.

Example:

  • Q: Help, I want to parse html with RegEx because I need to achieve X
  • A: RegEx is ill suited for parsing html, but X can easily be achieved by means of Y
5
  • I'd allow a different language when 'wants' is expressed as 'needs a shell script' but practically speaking they want something that'll run on a generic linux box. Thus whilst shell might not be appropriate, python or perl might be acceptable alternatives.
    – Sobrique
    Commented Apr 13, 2015 at 15:15
  • I think your particular example question would be marked as a duplicate... and a rather famous one at that! :)
    – Baldrick
    Commented Apr 15, 2015 at 12:34
  • Disagree entirely. Sometimes I am searching for how to parse html with RegEx to achieve Z, and being told to use Y instead is useless because Y can only do X, not Z. For the sake of future visitors with similar-but-not-completely-identical questions, you should answer the question that was actually asked, not whatever you think the asker really meant.
    – Benubird
    Commented Apr 15, 2015 at 12:45
  • @Benubird If a person asks how to achieve X with RegEx, the given answer can be very usefull for future visitors who also need to achieve X and think this can be done with RegEx. (Assuming it actually tells him how to do X). It will indeed not be usefull for people who want to use RegEx for Z, but that seems quite reasonable. -- In extreme examples you may want to assist searchability by suggesting a question title change from 'How to achieve X with RegEx' to 'How to achieve X' Commented Apr 15, 2015 at 14:23
  • This is actually a problem I have encountered. Not often, but I occasionally search for "how do I X", only to discover that the accepted answer is "don't, do Y instead". So I then have to post a duplicate question, and tack on the note "PS. I actually do need to do X, not Y". I think it is very important that the answer matches the question. If the asker asked X but meant Y, and the accepted answer is for Y, then someone needs to edit the question so that it is asking Y instead of X.
    – Benubird
    Commented Apr 16, 2015 at 7:59
4

I believe that depends on the question. If the asker looks for a high-level solution (algorithm, best practice, etc.) then an illustration in a different language may well be helpful and doesn't deserve a flag.

If the asker has issue with a particular library interface, syntax construct and the like, then an answer in a different language is not an answer.

By the way, questions about high-level concepts targeting a particular language (e.g. "how do I implement bubble sort in java?") are IMO as much of a problem as answers in a different language.

1

I don't think it's always invalid to answer in a different language. It may not meet the precise specification of the question - but that's ok. It's still an answer, and it may still be of benefit to future visitors to the site.

This is especially the case when talking about scripting languages. Sometimes people will ask for a bash solution, but given they have awk, sed, perl and python installed, I'd say answers in those languages are fair game. Again, may not help the OP, but might help future visitors.

Either way - it's an answer, it's therefore not suitable for flagging. I'd say if it's actively harmful or misleading, then down vote. If it's just not a lot of use, don't bother upvoting. It may prove a valuable addition to the collected knowledge of Stack Overflow in future.

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