13

Find the smallest positive integer that does not occur in a given sequence asked how to solve a particular Codility problem in Java (it was tagged with the tag originally).

Since then, the page has acquired answers in a variety of other languages that Codility supports (and maybe others, I didn't really check all 118). Many of those answers are very well-received. Eventually, the asker removed the tag.

Generally, we scope questions to one language/technology (with some exceptions for things like Java/Kotlin or JavaScript/TypeScript where there's interop between the two), which would make "solve this in any language" not especially well-scoped.

What should we do in a situation like this?

  1. Is it a problem? Or is it okay since all the answers address the problem of "how to pass this exercise in Codility?"
  2. If it is a problem, how should we solve it?
5

3 Answers 3

5

There are about 700 programming languages, including esoteric coding languages. Some sources that only list notable languages still count up to an impressive 245 languages

Source

Thus, considering a (very) small average of 10 answers per programming language (I've seen algorithm questions getting 20-50 answers), we can easily end with 2450 answers for such questions. Good luck finding a good answer for your language :)

Considering this, I'd say that questions that ask for solutions in any language are not a good fit for our site.

Closing them as "Needs more details" would be feasible, as this kind of questions lack one important detail - the programming language.

21
  • Any thoughts on how to fix a question already in this state?
    – Ryan M Mod
    Commented May 12, 2022 at 9:28
  • 4
    I'd say closing the question would be the first step, but not sure about the closing reason... maybe "needing more details", since they lack the important information regarding the programming language.
    – Cristik
    Commented May 12, 2022 at 9:30
  • 5
    I think I slightly disagree. I think language agnostic questions should be on-topic (assuming they are narrowly scoped), so long as the goal is to seek language-agnostic (algorithmic) resolutions -- these can be compared logically. Answers should not be language-specific implementations, but algorithmic expressions -- these can be compared equally considering, simplicity / elegance / computational complexity / memory usage / etc. This particular question was prey to scope creep via off-language answers over time. Commented May 12, 2022 at 10:54
  • 1
    "There are about 700 programming languages" is not very credible; the source you link to arrives at that number by counting the size of Wikipedia's list of programming languages, so "there are about 700 programming languages considered notable by Wikipedia's standards" would be more accurate.
    – kaya3
    Commented May 12, 2022 at 11:03
  • 4
    Regarding language-agnostic questions, these are absolutely on-topic when soliciting language-agnostic answers, there is even a language-agnostic tag for such questions with many good examples if you sort by votes. What we don't want is questions that are "language-agnostic" in the sense of soliciting answers written in any programming language.
    – kaya3
    Commented May 12, 2022 at 11:06
  • @kaya3 good point, "language-agnostic" was not the term I was thinking at when I formulated the answer, replaced it by "questions that ask for solutions in any language"
    – Cristik
    Commented May 12, 2022 at 12:50
  • 1
    Particularly in the case where the asker tried to limit the scope and the answerers were the ones who started posting out of scope, why would the solution be to close the question rather than deleting all the NAA answers? Seems like there's two options - either use the Codility as the limiting factor and remove any answers that don't relate to Codility solutions... or go all the way to java and remove all of the answers that aren't about Java.
    – Catija Staff
    Commented May 12, 2022 at 13:11
  • 1
    @Catija as long as the question was tagged java, deleting the non-java answers is OK, however question is what to do once the java is removed, or, worse, if there's no language tag to begin with?
    – Cristik
    Commented May 12, 2022 at 13:14
  • 2
    "Put the candle back!" (When it's removed)... if it doesn't exist (and should), that seems like it needs some work to catch early, honestly. I've seen the giant compendiums of "How do I do X in SQL" and end up sorting through giant list answers with 10 different variations and it's frustrating... I'd much rather have just one answer for my specific need. I think there's room in a handful of cases for thinking about things as canonical resources but then I'd rather have exactly one answer per tech.
    – Catija Staff
    Commented May 12, 2022 at 13:15
  • 3
    @Catija I hope you meant NAA in a broad sense? Because if not, that might lead to some confusion as on SO we practice a stricter definition, and flagging one as NAA will result in flags being declined.
    – 0Valt
    Commented May 12, 2022 at 13:20
  • 1
    @OlegValteriswithUkraine I'd argue that y'all use NAA in a too-broad sense, rather than "strictly"... The definition on SO is "does it attempt to answer some question, even if that question is not related to the actual question?" and my definition is "Does it actually attempt to answer the question asked right on this page?". I'd argue that mine is significantly narrower while the standard SO definition causes exactly this problem - "It's an answer to some variant of this question but it's not about Java, so we can't flag or delete it"... too bad!
    – Catija Staff
    Commented May 12, 2022 at 13:23
  • 1
    If the question is about Python and the answer is clearly about C# and not Python at all, it's NAA - period. I've had to go through this on several sites and this is exactly why - you end up with answers that don't actually answer the question. As an asker, I shouldn't have to say - "I don't care about C#, I need to know how to do it in Python!" Other sites explicitly require locations, for example, and if the answer doesn't relate to that location or culture, it's removed because it's likely misleading.
    – Catija Staff
    Commented May 12, 2022 at 13:27
  • 2
    @Catija I think the point Oleg raised is related to how non-mod users can handle this kind of answers. Flagging as NAA is likely to result in the flag being declined, and a custom mod flag puts more burden on the moderators team. The only way non-mod users can get rid of this kind of NAA is to vote to delete it, however for that to be possible, the answer needs to have a negative score...
    – Cristik
    Commented May 12, 2022 at 13:29
  • 1
    Note that there's at least one exceptional case contradicting Catija's comment on "Other sites explicitly require locations, for example, and if the answer doesn't relate to that location or culture, it's removed because it's likely misleading.": Law.SE allows answers from other jurisdictions and discourages duplicating similar questions (the top voted answer was practically ignored by the community)
    – Andrew T.
    Commented May 12, 2022 at 14:12
  • 2
    @Catija "If the question is about Python and the answer is clearly about C# and not Python at all, it's NAA - period." - Ummmmm no. Because a question about python does not necessarily have to be asking for code in python. It could be asking for an algorithm that would potentially work in python, which could easily be provided in any other language like C# as a form of pseudocode for the asker. You're massively overgeneralizing. Commented May 12, 2022 at 15:44
3

Generally, tags should be used to specify what a question is about, not what it contains.

An exception to this rule is questions containing code. Such questions should always be tagged with the programming language tag corresponding to the language used, or otherwise code formatting will not kick in.

Therefore it was an incorrect edit to remove the tag from this post for that reason. Even though code formatting in the question itself can be fixed through other ways, all the answers posted will have the code formatting removed as well.

2
  • 1
    (I am not the downvoter, I don't know why this would be downvoted.) I think tags are mainly useful for helping people find questions that they are able to answer. So tagging with the programming language is important for that reason, not just syntax highlighting.
    – kaya3
    Commented May 12, 2022 at 13:03
  • @kaya3 Yes of course but in this specific case the question is not about how to implement an algorithm in Java, but about the algorithm itself (and lots of the posted answers aren't written in Java)
    – Lundin
    Commented May 12, 2022 at 13:06
-16

I would ask OP's opinion. If he thinks having another langage's answer is ok for him, because he can works from there it's fine. If he's searching for langage specific answers, it wouldn't.

I would also invite OP to add the information in the post instead of being buried in answers.

I think however, same answer from another langages would be to be cleaned since they don't bring nothing new in the context of OP's question + tag.

Edit :

If the question can be consider quite generic without requiring specific langage dependent answer I don't see any problem.

However if we take the example given with Codity, which need more specific-language answer, I would join Cristik if the answer really have a need to be langage dependent, otherwise, I don't see an issue, we're not a copy/pasting service after all.

We could also argue that question from Codity stuff would be a better match for codereview, assuming the OP has already made his part.

5
  • 6
    But if the OP would accept answers in Java, C#, Brainfuck and Python, that'd make the question with its associated answers a wasteland to trawl through for future readers. If the OP can accept an answer in various languages. they'd need to ask the question (with appropriate research/effort in each of course) for each language. Otherwise the fragmentation makes the post unusable for anyone but the OP.
    – Adriaan
    Commented May 12, 2022 at 9:54
  • Honestly, that would depends much of the question. If the question can be consider quite generic, I don't see any problem. However if we take the example given with Codity, which need more specific-language answer, I agree. So in fact, I would join Cristik if the answer really have a need to be langage dependent, otherwise, I don't see an issue, we're not a copy/pasting service after all.
    – Walfrat
    Commented May 12, 2022 at 10:11
  • 3
    In case of a generic, language agnostic, e.g. an algorithm, question, a pseudo-code answer would be of much more use I'd say. I don't want to be trawling pointers and memory allocations in a piece of code if I do Python, which has all that stuff built-in. Multiple languages distributed over the answers is rarely, if ever, useful for future readers. Either make the question completely language-agnostic, or make one for each language separately.
    – Adriaan
    Commented May 12, 2022 at 10:19
  • I get what you want to say, but people answer with what they master. Furthermore in SO I think it is a requirement to answer with a working code, so you can't really post a psedu code answer. Or you would at least need to provide one concrete implementation of the said answer
    – Walfrat
    Commented May 13, 2022 at 11:10
  • Answering without code is fine (e.g. "No you cannot do this"). Answering language-agnostic, usually algorithm, questions with pseudo code is also perfectly fine, as is answering homework questions with pseudo-code to leave the actual implementation as an exercise to the reader. People answering what they master is of course appreciated, but better in well-distinguishable questions, i.e. one per language, rather than in a catch-all fishing bowl.
    – Adriaan
    Commented May 13, 2022 at 11:25

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