15

I get asked this question from time to time. It happened today. I don't know how to answer it, but I responded to a comment to please the user who seems to have found "some" workarounds but still wants me to explain why I need it and what it helps.

Sometimes I can't answer that. This is because I don't have the use case before-hand, but I still want to tackle the problem. This is exactly like Pure Mathematics, and in Pure Mathematics, you don't know a use case in advance, but you could discover a use case in future.

I generalize most of questions I ask, rather than being specific to my problem.

If I had become specific, I might not get a straight answer, but rather a duck tape type one, and other people in the future who might have the same question might not find the answer if I had become specific.

How do I respond to these type comments if I don't have a use case before-hand?

Link to that comment and the question

I had to post a full use case today due to the pressure. The community believes there are better alternatives, even when I added the wording "Runtime optimization". I have many years of experience and I have added this wording with responsibility and I am not throwing words out of my mouth just because I think so.

On 3/1/2021,

@TheVee answered my question. His answer is sheer black magic that amazed me. It is a pity that the question is closed. He had to answer the question via comments.

24
  • 37
    From the tour: "Get answers to practical, detailed questions" (emphasis mine).
    – yivi
    Commented Feb 26, 2021 at 8:41
  • 24
    And "You should only ask practical, answerable questions based on actual problems that you face." from stackoverflow.com/help/dont-ask; this works much better with concrete use cases because then people can suggest other ways to achieve the same thing, pure curiosity tends to lead to overly vague questions.
    – jonrsharpe
    Commented Feb 26, 2021 at 8:43
  • 11
    Remember that Stack Overflow is not meant to solve only your (practical) problem. It is meant to provide answers to users that have similar problems. If your question only exists in a lab setting / theoretical / highly specialized environment then SO is not the right venue. If no one understands your context and you're not able or willing to share / show the practicality of your question then you won't get answers.
    – rene
    Commented Feb 26, 2021 at 8:45
  • 25
    In short, your question is too generic – people are asking what you want to use this for because that is relevant information to decide what is a valid answer. Abstract and generic questions are also often subject to XY problems; the solution you are asking for might not be ideal to solving the underlying problem. Commented Feb 26, 2021 at 8:49
  • 6
    In fact that specific question is a bad example of what you're asking because it seems from the comments like you do have a concrete use case, in which case the short answer is that you should respond by editing the question to explain why you need this and how it helps you.
    – jonrsharpe
    Commented Feb 26, 2021 at 8:51
  • 5
    It's ok that you elaborate on an issue so it's not specific to your setup and settings. That's what building a MCVE usually entails. But that does not mean that the issue stops being a practical problem. If it's not a practical problem, it's much harder for it to get a good reception here. Although if the question is interesting enough, it can still get a good reception sometimes. But not practical + not interesting generally have people scratching their heads and asking for more details to figure out the problem.
    – yivi
    Commented Feb 26, 2021 at 8:52
  • 2
    Further to what others have said look at the XY problem. Giving the reasons you try to do something will make sure you're not going down the wrong path.
    – VLAZ
    Commented Feb 26, 2021 at 8:55
  • 3
    Why do the question got closed.
    – jeffbRTC
    Commented Feb 26, 2021 at 14:23
  • 2
    Why do you need to know how you should respond to those comments? How does knowing it helps you? Commented Feb 26, 2021 at 21:05
  • 2
    @RobertoCaboni I dislike leaking things I working on. These type questions always get ended up there. It's like a Rabbit Hole. Let's say you're working on Next Google (I'm not) and you post a question about Algo. The commenter asks why do you need it. That's nuts.
    – jeffbRTC
    Commented Feb 26, 2021 at 21:21
  • 4
    Nevermind, jeff, it was just a joke. A bad joke, apparently, since I have to explain it.. :) I feel you and I upvoted your question, because such general questions are the result of the attempt to tranform the real problem into a MRVE. Commented Feb 26, 2021 at 21:43
  • 4
    One thing I would like to add to what others have said: When you do add some information about your use case, make sure you aren't taking out the generic question and code. What you've created is a minimal, reproducible example, and with most askers it's like pulling teeth trying to get them to compile a generic example. Compared to most new questions I see, your question is quite good. I just don't want this situation to scare you into posting your whole darn personal project like most askers do. Commented Feb 26, 2021 at 23:15
  • 2
    You should not be generalizing your questions. Stack Overflow expects you to be very specific, so you have already answered your own question.
    – Zephyr
    Commented Feb 28, 2021 at 0:19
  • 4
    Often, they're asking because they think you're over-complicating a solution to something else. Like you're asking about x, but it's really y you want to solve. It's a valid question many times, but frequently, all I want to do is get an answer to x and the y is unimportant to me - because I like to tinker, I like to learn, or I am doing it because I enjoy solving puzzles. So I frequently respond with "I'm doing this for fun, because I like to tinker", and it is always successful at not having to get into y. People seem to accept that.
    – hepcat72
    Commented Feb 28, 2021 at 1:00
  • 3
    You misunderstand me. The question in your mind was very specific: accomplish X with a whole list of constraints which were not explained in the first draft. Many valid answers to the original question as written are ruled out by your hidden constraints, and then you say people lack imagination for not guessing those specifics.
    – Useless
    Commented Mar 2, 2021 at 15:32

5 Answers 5

80

Answer honestly. If there is a practical use-case, give a short outline. If there is no practical use-case, clearly state that you are looking for a generic solution.


Generic questions often result from askers over-generalising their use-case. By asking for a concrete use-case, commenters want to make sure the question does not hide an XY Problem or a more specific problem – in which case a different or simpler answer can be given.

When you actually have a generic question, that is fine by itself. Since it is usually more complex to solve generic questions, when in doubt people will want to make sure before investing too much work in an answer.

9
  • 21
    This is especially true if the thing op is asking for isn't possible, but there exist workarounds for specific situations.
    – BDL
    Commented Feb 26, 2021 at 9:23
  • @MisterMiyagi One commenter mentions that, "XY problems are sometimes useful because the answers could help the questioner understand why their solution wouldn't work, and better understand the original problem in the process."
    – jeffbRTC
    Commented Feb 26, 2021 at 9:24
  • 18
    @jeffbRTC XY problems are not bad in themselves. Indeed it can be worthwhile for an answer to explain why it is best to solve X instead of Y. However, that requires us to know about both X and Y. Commented Feb 26, 2021 at 9:29
  • @MisterMiyagi What if the post get merged to Y and X gets removed? Do I especially have to mention both X and Y in the question? How to decide a title when having both X and Y on the question assuming both are similar in nature?
    – jeffbRTC
    Commented Feb 26, 2021 at 9:49
  • 3
    @jeffbRTC My recommendation is just to ask the generic question – after all, that is what you want to ask. By the nature of asking a question, you don't know the answer and cannot anticipate whether it is better to solve generically or not. If people feel it is relevant to have concrete information, they will ask for it. Commented Feb 26, 2021 at 10:01
  • 4
    @jeffbRTC There might not always be a clear line between what is and isn't an XY problem, but the basic idea behind it is that you're trying to figure out something that's a really poor solution to whichever problem you're actually trying to solve (or perhaps the solution just doesn't have any practical application whatsoever or it's just impossible to get working). This means trying to answer Y can't really help anyone else. You don't "have to" do anything, but people may not feel inclined to help you, may downvote, or even vote to close, if you're stubbornly heading in the wrong direction.
    – NotThatGuy
    Commented Feb 27, 2021 at 9:27
  • 1
    @jeffbRTC If your question really is an XY problem, the best way to deal with that is often by rewriting it to ask about X instead of Y, but you can still mention Y as a way of how you tried to solve X. In some cases it might make sense to keep your question largely as is (asking about Y) and simply mention X in the question, but this is fairly rare and might imply that it isn't an XY problem (depending on how exactly you define that).
    – NotThatGuy
    Commented Feb 27, 2021 at 9:35
  • 2
    @NotThatGuy also, perhaps the Y is appropriate despite. Sometimes it turns out that the OP hasn't communicated some limitation that makes other potentially better options unavailable. However, it's hard to know whether that's the case or OP just doesn't know about the other options. Also, sometimes it turns OP was taking something into consideration that would limit their options but they shouldn't have. Since the "why" wasn't communicated, we're left guessing again.
    – VLAZ
    Commented Feb 27, 2021 at 12:47
  • @VLAZ Turns out there were better options that I'm not aware of. I got the answer today but question is closed......
    – jeffbRTC
    Commented Mar 1, 2021 at 17:01
29

I looked at a question the other day which was along the lines "how do I achieve X without using feature Y?". To answer that, I want to know why the OP thinks they can't use feature Y (which is the obvious way of solving the problem), because the constraint on the solution affects the answer. Perhaps they're using some old or buggy software that doesn't support Y properly; perhaps it's an exam question; perhaps they have a performance requirement that they haven't stated explicitly; perhaps they've had a bad experience using Y in the past and are now scared of using it again. In any case, as far as I'm concerned, it's the job of any professional engineer to challenge and scrutinise the requirements placed in front of you: you need to know what the client really wants, and what the real constraints are, so that you can be creative in coming up with a solution.

11
  • There is no feature Y on Javascript if you clearly read my question and it's not an XY question.
    – jeffbRTC
    Commented Feb 27, 2021 at 10:21
  • I'm not asking for Homeschool work. It's been long ago since I've completed my studies.
    – jeffbRTC
    Commented Feb 27, 2021 at 10:22
  • I need it to optimize runtime.
    – jeffbRTC
    Commented Feb 27, 2021 at 10:22
  • 5
    @jeffbRTC that still doesn't answer: why? Why this routine needs optimization? Is it expensive? Have you read about premature optimization?
    – Braiam
    Commented Feb 27, 2021 at 15:50
  • @Braiam It's expensive and funny thing is that it happen two times. I want to avoid two times. The user could use on-completed event or he could have used promise based version. Two damn times!!
    – jeffbRTC
    Commented Feb 27, 2021 at 16:34
  • @Braiam I added the use-case on question it-self ...
    – jeffbRTC
    Commented Feb 27, 2021 at 17:05
  • 7
    "how do I achieve X without using feature Y" is a perfectly valid question which does not require a single extra word if Y === jQuery :-)
    – The Vee
    Commented Feb 28, 2021 at 17:25
  • @TheVee Seriously, There is no feature in jQuery that does what I wants.
    – jeffbRTC
    Commented Feb 28, 2021 at 20:07
  • 1
    If the question is "how do I achieve X without using feature Y?" then you've interpreted it wrong. XY problem is usually in the form of "How do I achieve X without using feature Z?" and commenters will ask "What do you really want to do" by which they mean "what is your Y"
    – slebetman
    Commented Mar 1, 2021 at 3:52
  • @jeffbRTC Sorry, I was joking, no relation to the particular problem you posted.
    – The Vee
    Commented Mar 1, 2021 at 7:10
  • My use of the meta-variables X and Y was unrelated to their use in the term "XY-question". Sorry about the confusion. Commented Mar 1, 2021 at 9:24
12

How do I respond to these type comments if I don't have a use case before-hand?

With a simple "I don't have a use case. I'm just curious about how this works."

There's nothing wrong per se with asking questions out of pure curiosity. And often such questions can contribute to a deeper understanding of the mechanics in the language, even if they don't help to solve a particular problem. I have asked a bunch of those. Here is one example:

Can I trust (uintptr_t)NULL to be equal to zero?

I cannot see a special use case for that. Well except from being able to tell people using a "clever" construct that it's not only bad style and pointless, but ALSO have some objective drawbacks.

So if you're just curious, then say so. It's actually good to say that from the beginning, because the standard assumption is that you have an actual problem to solve and that you intend to use it.

0

If you generalize a question too much and if it asks on fundamentals, it sounds like homework. People are often hostile to homework questions. So any explanation where it's not homework can be useful -- that includes curiosity.

-3

Jerry: "Excuse me, I'd like to return this Jacket."

Store lady: "May I ask why?"

Jerry: (Breathes in and out) "... for spite."

(See it here.)

There's no good answer, really.

  • If you give the actual reason - you're likely to have the question derailed in a direction you don't care for that only talks about aspects of what you said you wanted to do. People might even mark it a dupe.
  • If you give a false/generic reason - people may continue to question you about it and not be satisfied.
  • If you refuse to answer, people are likely to get angry and preachy with you, downvote the question or close it.
  • If you say it's just out of intellectual curiosity, people might not believe you and claim that you're being evasive; or they'll think you're wasting their time with smart-ass useless questions and downvote it.

I'm not saying any of the above necessary will happen, but it's quite likely and in my anecdotal experience.


So... welcome to Stack Overflow, I guess.

0

You must log in to answer this question.

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