23

Usually, when I see a question like Bash or Python script to check numbers, I cast a close vote choosing needs more focus as the reason. This time around, I thought the question was salvageable, and made an edit that practically narrowed its scope. But it was promptly reverted by another user. Then I cast a close vote, and two other users followed shortly after, and the question was closed. But then again three users voted to reopen it; all of which can be seen from the timeline. Hence this meta question.

Am I wrong that questions like this are too broad for Stack Overflow, and thus off-topic? Given that multiple users who have way more experience than I do disagreed with my decision, I think there's something I'm missing.

26
  • 13
    Regarding the edit: I'm not sure the other editor really saw your edit. Theirs came only 40'' after yours, and being more extensive (but not including the narrowing of the question scope) it's not unlikely they were editing the question at the same time, and submitted their edit which trumped yours.
    – yivi
    Commented Jul 1, 2021 at 9:43
  • 19
    I agree that a question that looks for solutions in either of two different languages should be closed as "needs focus".
    – yivi
    Commented Jul 1, 2021 at 9:48
  • 3
    Seems like a text-processing question. There was a question posted about those recently on meta: Re-tagging questions related to Unix/Linux text processing out of shell specific tags
    – VLAZ
    Commented Jul 1, 2021 at 10:33
  • 20
    It's borderline, IMO. The intent from the question body seems to be that Python gets the preference, but this reads like a "... but if someone has a solution in some other way, I'm happy to take anything that makes my problem go away". Not the highest quality question but I'd give it a pass myself.
    – Gimby
    Commented Jul 1, 2021 at 12:35
  • 13
    I agree with @Gimby; I can see why some would see it as closeable, but I would personally leave that open. We close questions because they aren't answerable or are off topic (or already have an answer in the case of duplicates)– adding "will accept answers in bash or python" doesn't make this question less answerable in any way, shape, or form. Our goal should always be to salvage questions first, not to close the most things.
    – zcoop98
    Commented Jul 1, 2021 at 14:59
  • 3
    @zcoop98 which is what oguz did, edit first rather than close. We can't have nice things.
    – Gimby
    Commented Jul 1, 2021 at 15:05
  • 3
    Honestly, this looks like a pretty bad case. The OP already has the desired behaviour in Python, they just want to print Fail instead of False and Pass instead of True. So the question to answer for Python is a completely different one than the one for Bash. Commented Jul 1, 2021 at 18:32
  • 6
    This is a high quality python question. OP is open to some bash foo so adds the bash tag hoping a shell master may see it. I don't see the problem. OP doesn't require a bash solution so duplicating the question just to add the tag... and get closed because everyone is up in arms that a bash question has python in it ... seems the worse option.
    – tdelaney
    Commented Jul 2, 2021 at 2:57
  • 3
    @tdelaney Then it should be edited to be a Python question. If OP still wants to know how it is done in Bash he should ask a separate question. Having two discussions each focused on a specific technology and packed with pertinent information is better than having one piss contest. Commented Jul 2, 2021 at 4:18
  • 9
    @MisterMiyagi - It has everything needed to answer the question. Code, example data, a problem statement, current output, desired output. That's a hiqh quality question. its a fairly complicated bit of code that doesn't do what the author wants. Even if it was a pretty simple if .. else that OP doesn't understand, so what? I see a couple of reasonable answers and others maybe not so good... but that's what down votes are for. I have a 4 line pandas solution that I can't post because somebody got pissy that its tagged "bash".
    – tdelaney
    Commented Jul 2, 2021 at 6:07
  • 5
    @oguzismail They have something very important in common: they can be run in a terminal/shell. Taking advantage of multiple methods is a good thing and the specific tool isn't important here. And for the anal-retentive in the room, questions can be assigned multiple tags; remember, tags are a means of connecting experts. As to other complaints… there are multiple answers all from the same day, despite multiple closure shenanigans. People should not get carried away. This question (and many responses) provides an example of why a text-processing tag would be beneficial.
    – Mockman
    Commented Jul 4, 2021 at 9:46
  • 4
    Very little is necessary but for this question, it is appropriate. Don't look at it as a language question. It isn't one. Unless your requirements are very narrow, what value is added by forcing an awk answer to be separate from a sed answer? Your comment crystallizes the issue of viewing the world through a single, all-encompassing lens.
    – Mockman
    Commented Jul 4, 2021 at 10:09
  • 4
    No. What I mean is… so what if that answer came in awk, sed (or bash, or any other shell), etc…. To generalize, in the context of a java development environment, your position makes sense (I don't know but I concede the point). Imposing such a rule brings order. In the context of the text python/bash question, it does not. Imposing the same rule stifles. Your comments here and on the previous post suggest that you see this but then you argue against yourself.
    – Mockman
    Commented Jul 4, 2021 at 10:37
  • 5
    It is not junk.
    – Mockman
    Commented Jul 4, 2021 at 10:53
  • 5
    A duplicate question for each tool solves your case-specific problem? Despite three closures there are six valid answers using three different tools, all upvoted. There is no confusion for the people answering, yet those zealous to close are confused as to whether it's overly broad or unfocused. And why must people search the way you would? For example, search for a python answer and find it without including every possible tool. FWIW, 'check numbers' > 74K. The solution to a weakly worded question is to improve it, not bury it. Closing should be a last resort, not the first.
    – Mockman
    Commented Jul 4, 2021 at 12:52

6 Answers 6

12

If the question is about programming languages, it is definitely on-topic. The question here is rather if the question is too broad or not.

Generally:

  • A single question should not discuss two different solutions in two different languages at the same time. That's very confusing to read, and those two may answer are not necessarily good at both languages. Python and Bash don't have much in common, for example.

    Such questions should be closed as too broad and the OP should be prompted to edit it into shape by removing one of the languages and ask a separate stand-alone question about the other language if needed.

  • The same goes for languages that are closely related but still different. Most notably C and C++, tagging a post with both languages is a constant source of conflicts. These two languages are so different nowadays that answers are almost always different. Questions about the "C/C++" language are likely to get down-voted and closed as unclear. So please don't do that. Read the C tag usage and C++ tag usage for details.

    (We came up with cross-tagging policies couple of years ago here and they have been working out pretty well.)

  • Questions asking how to do the same in different dialects of a language could either be OK or too broad.

    Bad question: "How do I solve this problem with smart pointers in C++03 or C++11". Smart pointers being a feature that has been completely changed between C++ versions. This question is too broad and should be closed until the OP can narrow it down.

    Good question: "What exactly is the difference between C++03 auto_ptr and C++11 unique_ptr?" (some details about the OP's own research of the topic follows, maybe some code examples that they don't understand etc). This question is asking specifically about the difference between language dialects/versions. It should use both language version tags.

And finally, please note that questions of the nature "answers in language X or Y is acceptable" are almost certainly unclear and too broad. This isn't some free of charge restaurant where you might order whatever you like. Most of the time such questions are just homework dumps.

4
  • 1
    Instead of "too broad", do you mean "needs more focus"? The "too broad" close option no longer exists. Commented Jul 4, 2021 at 9:26
  • 2
    How does this apply to the question in question? The constraints the OP has are not in any way relevant to those —for example— being discussed in the tagging article you referred to. People who have such a problem to solve, are better served by reading one good page seen by as many people as possible, with numerous answers and with commenters recommending improvements and pointing out issues than to have to read multiple pages with fewer answers with fewer critical contributions.
    – Mockman
    Commented Jul 4, 2021 at 10:00
  • @MarkRotteveel A rose by any other name...
    – Lundin
    Commented Jul 5, 2021 at 6:36
  • "Most of the time such questions are just homework dumps." - I doubt that. I think they most often come from people who just want some quick practical problem solved in the workplace and don't care whether they use code in any particular language, or a shell script, or third-party tool, to get it done. Homework assignments are usually quite specific about what programming language should be used - for that matter, most programming courses deal with one specific programming language. Commented Oct 25, 2023 at 19:41
12

TLDR: Questions asking for solutions in multiple programming languages are implicitly asking several questions at once. Such a question should be closed as needs more focus until it is restricted to one language only.

If it is already clear that one language is the main goal of the question, e.g. due to comments, help the asker and edit the question directly.


Questions requesting solutions in more than one distinct* language are effectively asking several questions:

  • How do I do X in language A?
  • How do I do X in language B?

This is especially the case if the question already provides code, research, or similar that would make an answer for language A have a different scope than for language B.

That is just not a helpful situation to collect generally useful Q&A. For people caring about language A the solutions for language B are noise and vice versa. For people not caring about language, the restriction is entirely useless.

The needs more focus close reason applies both in terms of symptom (multiple questions at once) and steps to make the content generally useful:

This can often be fixed by breaking the question into multiple questions or focusing on a specific part of the problem.

If people actually care how to do X in languages A and B, they can ask separate questions. If people prefer to do X in language A, they can remove B from the question.


* There is a case to be made that two languages which are very similar or belong to the same ecosystem might share similar answers for specific issues. Use your best judgement.

4
  • 2
    I would note that two questions might be about the same API -- e.g. the Excel object model, a WPF application, or a REST API -- in different languages.
    – Zev Spitz
    Commented Jul 1, 2021 at 20:05
  • 2
    What if the OP asks for the same programming language, just different flavours? Typical example is SQL with multiple database products tagged. For simpler cases the answer could potentially be the same across all products, but you really need to know all tagged products to be sure.
    – Shadow
    Commented Jul 1, 2021 at 20:52
  • @Shadow That is why I added the "similar languages" bullet. In how far does it not cover what you say? Commented Jul 2, 2021 at 5:23
  • 4
    I think what you wrote: "That is just not a helpful situation to collect generally useful Q&A. For people caring about language A the solutions for language B are noise and vice versa. For people not caring about language, the restriction is entirely useless." is the most compelling argument I've read so far, even though I didn't agree initially. Having questions with cross-language relevance that aren't specifically tagged with [language-agnostic] or [algorithm], for instance, makes them much harder to catalogue, and difficult for readers to find and consume later.
    – zcoop98
    Commented Jul 2, 2021 at 14:17
4

If the only thing wrong with a question (and I do mean the only thing wrong; it has to be on-topic, detailed, well-scoped, and otherwise answerable) is that it includes 2 languages, then I really think editing is the best approach, not an immediate VTC.

I agree with you that trying to edit the post first is a good call, and I also think that this practice should usually be applied in the general case, unless a question has other problems that the post's OP needs to correct.

After all, the goal here is to curate our library; we should prefer salvaging useful additions to that library over destroying anything that isn't perfect on first read; improving existing posts is why edits exist in the first place. Throwing out otherwise useful questions for a detail that doesn't even make them unanswerable is definitely a loss in the long run, not a gain.

6
  • 4
    I very much agree with putting the emphasis on editing over closure when it is possible to salvage the question, but what would you propose that the hypothetical editor do? Arbitrarily pick one of the languages to focus on?
    – Cody Gray Mod
    Commented Jul 2, 2021 at 15:37
  • @CodyGray we have editorial privileges, so yes.
    – Braiam
    Commented Jul 2, 2021 at 15:38
  • 7
    That seems like it is not in keeping with the requirement to respect the author's intent. It also very difficult to time that edit appropriately so that it does not invalidate any existing or in-flight answers.
    – Cody Gray Mod
    Commented Jul 2, 2021 at 15:41
  • @CodyGray well, I prefer respecting the author intent, except when they are obviously wrong and don't know how to ask questions on SE. If there's a way we can fix the issue, painting ourself into a literal wall with our "rules" seems like being ineffective and a sign that we created bad rules.
    – Braiam
    Commented Jul 2, 2021 at 15:53
  • 1
    @CodyGray I don't have a great solution to offer, I think it heavily depends on the case-by-case contents of the question. If it's clear that the post is mainly about one over the other, then I don't see making that call in an edit to be violating author intent. But for other posts, it's going to be far less clear... It would probably be worth a comment asking the author to pick one or the other, and/ or a closure in that case, if we're sticking to the idea that these sorts of questions should be closed. I'm still not 100% sold on that idea myself, to be honest.
    – zcoop98
    Commented Jul 2, 2021 at 16:21
  • 1
    IMX in most cases there is a fairly clear choice to be made between multiple languages offered by OP, except in cases where the question is clearly just unsalvagable garbage. For example, in the case that motivated this post, the OP included a Python attempt already. Commented Oct 25, 2023 at 19:48
3

I will say it depends; but just because asking question for multiple languages does not make it broad. Please refer to this great question.

But yes; in some cases it might be. For example say: "How do I programmatically do this?" is broad because there are unlimited answers.

On the other hand, "How to do this in any .NET language?" looks better scoped. Or even better, "How to do this in C# or VB.NET?".

Also, this problem is not just limited with programming languages. The same logic can be extended to tool kits.

The "How can I write CD/DVD in C#?" is broad for two reasons:

  1. Its broad; OP have not specified what they tried and what exact problem they face. It might be very long answer (a source code of library) which makes this broad. But, we will neglect this reason for moment.
  2. There are multiple ways to write CD/DVD in C#. You may use implementation provided by Microsoft. You may use one of the third party libraries available.
    Using Microsoft implementation will need an article to explain; not an answer.

So, if OP decide which toolkit they are using, explain what they tried and then ask specific question, that makes it much sizable.

So, it does need more context to take decision.

2
  • Well, to me, that question is too broad also. Commented Jul 2, 2021 at 11:48
  • @oguzismail Why do you think it's too broad? Keep in mind that generally a C# solution will be easily convertible to a PowerShell solution, and vice versa.
    – Zev Spitz
    Commented Jul 3, 2021 at 22:02
1

I'd say it depends on the languages. If the languages are similar enough that the answer is likely to be the same in both (eg. different dialects of SQL, or some C/C++ questions), it's acceptable. Most of the time, though, it's too unfocused.

3
  • 7
    Good solutions in C and C++ are nearly never the same (unless it's extremely basic like "how do I increment an integer" which would be worthless anyway)
    – 4386427
    Commented Jul 2, 2021 at 7:32
  • 2
    Unless the question is restricted to ANSI SQL or simple queries then it is unlikely that a solution for SQL Server would be applicable to Oracle SQL or PostgreSQL (or vice versa).
    – MT0
    Commented Jul 2, 2021 at 10:35
  • 4
    We already have rules against cross posting C and C++, see the respective tag wikis. The two languages are so different nowadays that answers are almost always different. Questions asking for answers in "C/C++" are likely to get downvoted and closed as unclear. So please don't do that. Read the C tag usage and C++ tag usage for details.
    – Lundin
    Commented Jul 2, 2021 at 12:59
-4

TL;DR As long as a single-language answer in any of the tagged language is enough and there’s no (potentially implied) comparison between solutions in different languages, I think there should be some tolerance for multiple-language questions.


Typically the asker might not be aware what the best tool for the job is, and it’s very common to see questions like:

 How do I do X with sed?

where the answer is:

 Doing it with awk is so much simpler

Similarly, something might be trivial in python and really nasty in bash.

We have to think about why broad questions are bad: It’s because they can’t be covered in a single answer. That’s definitely not the case here: any solution will do, you clearly don’t need to provide them all in your answer. That’s a big difference with:

  • a question which asks how to do something in several languages simultaneously (what most answers here seem to tackle), not in any of several possible languages.
    This additionally removes the requirement for an answerer to be proficient in all languages asked about.
  • a question asking « what’s the simplest way of doing X? », which leads to opinions and bikeshedding.
  • a question on related languages, which is inherently asking to discuss what the differences are between the variants

Additionally, the fact there isn’t a single correct answer but multiple possibilities is not in itself disqualifying, this happens all the time on single-language questions also.

In short I think the right way to ask questions that ask for a solution in (any of) a couple of languages would be to pick a main language, as in

 How do I do X in bash? By the way if it’s hard but trivial in python I can use that too.

12
  • Of course with usual caveats of having shown effort and research etc. ; not just « please do this work for me ». But that stands regardless of this discussion.
    – Cimbali
    Commented Jul 3, 2021 at 0:39
  • I am rather irritated by the implications of your leading argument in the general case. Yes, I see the language being exchangeable if the OP uses us as a code-writing service of an entire program (though why restrict it to two languages then?). But in the general case, if I ask „How do I do X with python?“ and some jokester answers in C++ because „Doing it in C++ is much simpler“, that is not in the least bit helpful. The bash ecosystem, where individual tasks are done with separate languages, seems like an extreme outlier. Commented Jul 4, 2021 at 5:41
  • 1
    Anyway, I disagree with the core idea that „any (language) solution will do, you clearly don’t need to provide them all in your answer“. Q&A on Stack Overflow is not just for the initial asker, it’s for everyone with the same problem. Most people do need solutions in a specific language; „language A or B“ questions will inherently attract people looking solely for A, and any answer for B is at best noise. Not just that, the voting, acceptance, commentary, and more will have very high noise. These are also cases that the needs focus criteria is meant to avoid. Commented Jul 4, 2021 at 5:56
  • Yeah in some questions, any language solution will do. Sometimes achieving the goal is more important than which specific technology is used. Or rather any solution in a pre-selected set, you're right that answering a bash question with C++ is going too far. But I've tried to do things in C that could only be done by changing from gcc to clang. Same thing with "any .NET language, VB or C#" in the question cited by Amit Joshi.
    – Cimbali
    Commented Jul 4, 2021 at 18:02
  • I don't think it makes the question less useful to future visitors either, it's likely if this kind of constraint is reasonable it is also likely to apply to other people with the same issue. What's more if you want to find out how to do something, seeing how to do it using another technology is often a pretty good starting point.
    – Cimbali
    Commented Jul 4, 2021 at 18:03
  • 2
    See, the problem is, deciding on the right tool for solving the task at hand is a part of the initial research effort we expect from askers. Write a program that does X in any language and give it to me is too much. Commented Jul 4, 2021 at 18:25
  • write a program and give it to me is a strawman and a bad question regardless of language tags. All I’m saying is you, as an asker, don’t always have the expertise to determine what the best tool is − I’m especially thinking of more advanced questions. Is this asm question a bad one? (Initial revision contained an attempt at the solution.) It doesn’t specify which tool to use for the job…. That’s apparently been useful to other users, and there’s definitely no better place than SO to get an answer − especially available to all.
    – Cimbali
    Commented Jul 4, 2021 at 20:30
  • 1
    That question has been viewed only 200 times in 5 years and hasn't been voted on since 2016. You need to find a better example, this one shiould be closed and deleted. Commented Jul 5, 2021 at 4:04
  • There are better examples, but I wasn't going to use someone else's question - due to the pettiness of the meta effect. I really think that kind of question, finding a rare expertise on a niche topic and keeping it available for all, is where SO shines. This is the repository of knowledge d'ide of things
    – Cimbali
    Commented Jul 5, 2021 at 7:34
  • 1
    I see language agnostic questions (including those covering an entire ecosystem such as .Net) working pretty well – and I hope most do. What I'm not convinced about is that this is comparable to arbitrary multi-language selections. What is the ecosystem behind bash and python? Is it Linux/Unix? Is it every shell competitor? Is ruby in there – why or why not? And if there is a broader ecosystem the language aims at, why not tag it with that instead of randomly restricting the question to a few languages? Commented Jul 5, 2021 at 7:46
  • I’m not saying any combination of tags works − what you call an ecosystem seems to be a good definition for a valid combination languages. Not sure if there are always appropriate « broader ecosystem » tags, but a common reason to tag languages within an ecosystem could be to increase visibility of the question I suppose.
    – Cimbali
    Commented Jul 5, 2021 at 8:02
  • People are entitled to ask how to do X in Y even knowing that Y is a poor tool for the X job; and questions of that sort are perfectly on topic and may even be interesting and useful. Maybe doing X comes in the context of a larger project where Y is suitable, and interfacing to something else just to get X done would be too much work, or too much overhead. Commented Oct 25, 2023 at 19:45

You must log in to answer this question.

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