12

I try to avoid ever asking anything on Stack Overflow. Most questions have been already been asked and answered.

Recently, however, I have branched out into a couple of new areas and the complexity of what I am doing means that my questions are more specific and less likely to be easy to find, in part down to my poor understanding of the nomenclature.

I recently asked a question about programming in Swift, which is put on hold as primarily opinion-based. Is this likely down to the question invoking the concept of 'Best Practice' or is there another key aspect within the question that got it flagged it as opinion-based?

On top of that, I try and be direct but also provide as much backstory and detail as is relevant.

Does the linked question (and in fact this question) demonstrate appropriate level of detail for Stack Overflow or should it be more direct? (e.g. pretty much the title of the question)

Also, to what extent can you answer a question you think someone is trying to ask rather than the one that is being put forward?

6
  • 2
    Your second revision is better although I would try to get rid of the last sentence (or incorporate it somewhere else). Also note that if you have working code (although self-acclaimed hacky) you need to be clear what you want to improve on it (I don't want to use NSView.layer.anchorPoint because [lots of reasons here]) or an goal you want to reach (I need this to run 30FPS, it only runs 15FPS [because I meassured the calls to FuBar] and it didn't improve when I did foo).
    – rene
    Jun 11, 2018 at 12:33
  • Thanks very much for the tips. The last sentence is actually something I would like to know, is it best to ask a separate question with regard to that?
    – fdcpp
    Jun 11, 2018 at 12:35
  • I can't judge that as the topic itself is way outside my level expertise.
    – rene
    Jun 11, 2018 at 12:40
  • "Is likely down to the question invoking the concept of 'Best Practice'" -- Indeed, asking here about "best practices" does not work well. Fortunately, it is almost never necessary to do so.
    – duplode
    Jun 11, 2018 at 15:22
  • 3
    "urgent" and "please help" come to mind as words/phrases to avoid like the plague.
    – MonkeyZeus
    Jun 12, 2018 at 13:17
  • 1
    I think both questions are okay in their current form, and they are not dupes. A more general question per definitionem can't be the dupe of a narrower one.
    – peterh
    Jun 18, 2018 at 22:29

3 Answers 3

15

I voted to close this as Primarily Opinion-Based (POB) and don't think it is reopen-worthy at this time because of what you are asking:

Setting the view.frame origin to an offset of the centre achieves what I want but cannot help but feel this is a little 'hacky' and that I may be approaching this the wrong way. Especially since any further change to view.layer or view.frame will result in either the animation being incorrect or events being detected outside what is drawn.

How do you alter NSView.layer so that it rotates at it's centre at the same time as setting the NSView.frame so that mouse events are detected in the correct area?

Also, is altering NSView.layer.anchorPoint the correct way to set it up for rotation around it's centre?

(bold and italic emphasis mine)

You've got a working solution, so this isn't a debugging or "my code isn't working" question. Then you ask how other people implement this thing that you've successfully implemented, which is an off-topic question on SO (see Don't Ask: "your answer is provided along with the question, and you expect more answers: “I use ______ for ______, what do you use?”")

Finally you ask if there is a correct way to do what you've done; typically questions asking for the 'right way' to do something are going to be a matter of opinion- if you manage to write code that does what you want (as you have in this question), then that is the right way because it works. Someone else can write different code that works... that's the right way, too. They may not be the best or "most recommended" way, but such considerations are opinion-based.

In cases where you have working code that you feel is 'hacky' or otherwise might be able to be written more elegantly, you should ask your question on Code Review instead... assuming your question follows or can be edited to follow their guidelines (see https://codereview.stackexchange.com/help/how-to-ask for more detail).

17
  • I think that is fair. Part of me was thinking that what I was doing was way off the mark and more experienced Swift users may highlight some faults. I think in this case what I am doing is probably fine. I will need to go back to the drawing board and see if I can get to the bottom of what is bugging me and ideally re-articulate it in a way that would be useful. Is it best for me delete this question and the linked question now?
    – fdcpp
    Jun 11, 2018 at 13:55
  • 1
    @fdcpp One relevant concern is whether, in your scenario, the view.layer or view.frame will change on their own (rather than get changed by you), causing your solution to break. If they can/will, then you could try to edit the question to focus on that aspect (e.g. "my code breaks if X changes; how can I implement this functionality so that it works irrespective of X") and get rid of all the "how would you do it" and "what's the correct way" stuff that follows. Then you no longer have a solution that truly works, and it could be treated like a different kind of question.
    – TylerH
    Jun 11, 2018 at 13:59
  • @fdcpp If you want to go ahead and post on Code Review, then yes you could delete the question on SO (though you can't delete this one due to it being answered and upvoted). But if you want to try and edit it per my first comment ^ then obviously you would not want to delete it :-)
    – TylerH
    Jun 11, 2018 at 14:01
  • @GilHamilton That's a fair point, I should remove the POB bit about "better" and have done that; the difference there though is that question is asking for how to do something in general, and doesn't ask for the "correct" way. As my comments to fdcpp here indicate, it's about how you ask the question; he could probably edit his question and remove some of the problematic verbiage and change what he's asking for it to be OK here, though I maintain that Code Review would be better.
    – TylerH
    Jun 11, 2018 at 15:23
  • @TylerH So... your question is different because you edited the POB trigger words out, but this question should be posted on code review? Why not... edit the POB trigger words out?
    – user4639281
    Jun 11, 2018 at 15:29
  • @TinyGiant It's not just some trigger words, it's OP's whole question. The question being asked would need to change, which is OP's purview, not mine. In my case the issue was one word.
    – TylerH
    Jun 11, 2018 at 15:30
  • 1
    I'm not seeing it. The only thing holding this question back is the last sentence AFAICT, and that still seems fairly innocuous. The meaty question is "How do you alter NSView.layer so that it rotates at it's centre at the same time as setting the NSView.frame so that mouse events are detected in the correct area?" which... doesn't seem POB at all actually. The "Also, is altering NSView.layer.anchorPoint the correct way to set it up for rotation around it's centre?" would probably suffice in a comment under the question.
    – user4639281
    Jun 11, 2018 at 15:36
  • 1
    @TinyGiant I read it as "How do you" as in the question type that should be avoided per the help center "I use X for Y, what do you use?" which is problematic because the question isn't just "how to do it" but "I have done it, but I don't like how I've done it" (without specifying why not). I feel like I'm getting into broken record territory here, but as my comments to OP above indicate, given some reasonable assumptions I think the question could probably be edited to be on-topic. OP has not responded or edit the question to follow suit, though.
    – TylerH
    Jun 11, 2018 at 15:44
  • 1
    Err... You're saying all how-to questions are off-topic.
    – user4639281
    Jun 11, 2018 at 15:44
  • 2
    @TinyGiant I'm not saying that at all. In fact I'm saying the opposite.
    – TylerH
    Jun 11, 2018 at 15:44
  • 4
    Well seriously now. Asking "How do I do X? This is what I've tried, but it does not satisfy my requirements because X" has never been off-topic. That's what we tell people to do all the time!
    – user4639281
    Jun 11, 2018 at 15:46
  • @TylerH I appreciate all the input. Apologies, I did not mean to cause a fuss. OP has not responded or edit the question to follow suit, though. After looking into Core Animation a little deeper I think it will probably take me another day. As that too long to wait to edit or is that a respectable period of time for stackoverflow?
    – fdcpp
    Jun 11, 2018 at 18:06
  • 1
    @fdcpp It's never too late to edit a question of yours in an effort to get it reopened. If you do so, please feel free to @-ping me in the SOCVR chatroom about it and/or make a formal [tag:reopen-pls] request of your own there.
    – TylerH
    Jun 11, 2018 at 18:47
  • 4
    I've occasionally considered writing an "SO forbidden words" user script that would detect phrases likely to trigger knee-jerk down/close votes on SO questions and suggest replacements. One of the replacements would definitely be /How (do|can|could|would|should) you /"How $1 I ". Jun 11, 2018 at 20:24
  • @IlmariKaronen While mildly useful, such a script would require being known to be used; I think the audience that would most benefit is the audience which, by definition, would be the least aware of such a thing. Even so, such a script would only solve one of the various issues leading me (and others) to view the question as close-worthy.
    – TylerH
    Jun 11, 2018 at 21:24
12

I don't understand the antipathy toward this question, especially in its edited form. I see very valid questions in SO all the time that are quite analogous; in effect:

I did some ugly thing that provides the right answer but I can't help but feel it's the wrong solution in my language/framework/etc. Is there a better way?

That kind of question is often answered by multiple people using different methods -- some of those will be better, some worse (as with many/most questions). And sure, there may be an opinion embedded in those answers, but those opinions are not mere arbitrary political statements. They are often informed by years of experience in the field that can be very valuable to the less experienced.

The "Is this the correct way...?" question is asking answerers to point out what unforeseen negative effects the current method may have down the road, or advantages the OP might not be aware of by implementing it another way. These are all valuable things to have on SO.

14
  • 5
    If the question is correctly scoped, I agree with you, There's a big difference between "Is my use of mysql_real_escape_string() here the correct function to protect from SQL Injection" and "Is this code secure." The former sounds like a valid SO question, the latter doesn't. OP's question has some elements of both.
    – JeffUK
    Jun 11, 2018 at 15:14
  • 5
    The problem is "is there a better way" is critically vague, making it POB. To one person, "better" might mean "faster". To someone else, it might mean "fewer lines of code". To a third person, it might mean "never use this specific implementation a feature". My comments to OP under my answer detail how that can be improved.
    – TylerH
    Jun 11, 2018 at 15:25
  • 4
    @JeffUK OP's question doesn't ask "is this secure?" or anything remotely similar. He asks first "how to do X". Then he asks for the correct procedure for setting up his framework. This really does seem to be all about "trigger words" in the question which strikes me as pedantic. Jun 11, 2018 at 16:07
  • @TylerH your position seems to be that your own question is now not POB because you removed the single word "better"? Jun 11, 2018 at 16:08
  • 2
    @GilHamilton 1. it's an analogy, this is meta. after all. 2. He asked a pure 'opinion based question' originally, but has edited in a few specific questions as well; which is why I say it's a bit of both. It's now 'Too Broad' because it contains multiple questions, some of which are opinion based.
    – JeffUK
    Jun 11, 2018 at 16:13
  • 1
    @GilHamilton Not sure if you meant to reply under this answer but yes that was the only opinionated word in the question you are referring to.
    – TylerH
    Jun 11, 2018 at 16:13
  • 3
    @TylerH How is asking for "other ways" to do X fundamentally different than asking for "other, better ways"? I presume you aren't seriously interested in worse ways to do it. So again the difference is purely pedantic. Jun 11, 2018 at 16:18
  • 2
    @GilHamilton I'm not sure what you think is opinion-based about "are there other ways". Remember that "no" is a valid Stack Overflow answer. Also, no, I'm not interested in "worse" ways, but I don't ask for that or for "better". I specify what I'm asking for as qualified answers in the very next sentence (in case you are still missing it - more efficient or responsive implementations, two real areas where my one known implementation suffered). OP didn't clarify any real areas where his code suffered, which I've already commented on in comments above and in chat at length.
    – TylerH
    Jun 11, 2018 at 16:21
  • 1
    @TylerH "Are there other ways" is not substantively different to what the OP asked in his question that you voted to close for being opinion-based. Jun 11, 2018 at 17:33
  • @GilHamilton It is, actually, if you take a look at my answer above, which enumerates the ways. I've added a bit more detail to it in an effort to help you.
    – TylerH
    Jun 11, 2018 at 18:49
  • 1
    @TylerH Again that doesn't distinguish this question from yours, where you provided your own answer but then asked for other "more efficient" implementations. But in your answer above here, you said that "[if] you have working code that is simply inefficient... you should ask your question on Code Review instead" Jun 11, 2018 at 19:01
  • @GilHamilton I didn't put my answer in the question like the help center says, and I didn't say "it works for me", in fact I specified two ways where it fell short. You're right that I should clarify the efficiency part. In CSS, selector efficiency is a specific and narrow subject; in this case I meant efficiency in a general (broad) sense. I'll clarify further for you in the answer above.
    – TylerH
    Jun 11, 2018 at 19:08
  • Just look at how many questions about Python ask for "the most Pythonic way" to do something. If only all languages had such an adjective (Javascriptic? C-plusplussy? C-sharpish? Java-esque?) then you could ask for the best way to do something in any language. Jun 12, 2018 at 0:12
  • @m69 that is (AFAIK) only because the official documentation of python is talking about how to be pythonic in python. Python gets shipped with some philosophy and AFAIK that is not done by other languages.
    – Kami Kaze
    Jun 12, 2018 at 13:23
-3

There are no terms that you should specifically avoid during question construction, as long as your question is a valid question for stackoverflow as described in the help section.

How-to-ask is a good place to start on how to ask good questions.

In fact, this question gives a good example of where you could improve. Your question title "What terms should one avoid in question construction?" (the question I'm answering here) doesn't really describe the question you are asking: "Is asking for best-practice advice always 'Opinion-Based'" would be a better summary.

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