17

I asked this question. I spent a lot of time explaining what I had tried, what worked, and what didn't work. I asked how to do it better and it got flagged as opinion-based and was closed. Ok, so I edited the question to be more specific in terms of "how do I " and listed specific things I was trying to accomplish. It is still closed and still flagged as opinion-based and I don't understand why. Please provide feedback as to why it is still considered opinion-based and how I can get my question opened for answers.

Update: I made many of the recommended changes to the question including breaking important stuff out into bulleted format, stating why I didn't like the solution I came up with, and specifying specific things I wanted to achieve. The question did manage to get opened and I did get a suggestion that leads to a good solution.

13
  • 18
    This is the root of the problem: "So this works and it does what I want it to do but it's not very clean" You have a working solution, you're not asking us to solve a problem. A rewording may help.
    – Kevin B
    Commented Apr 26, 2021 at 21:09
  • 3
    Hmm, I'm not a SME but to me it doesn't look opinion based after the edit. You need to wait for people to reopen it.
    – 10 Rep
    Commented Apr 26, 2021 at 21:10
  • 3
    For example... instead of "but it's not very clean", be more specific. "but i'd rather do it without doing x"
    – Kevin B
    Commented Apr 26, 2021 at 21:16
  • 4
    Perhaps the question is more suited to the site softwareengineering.stackexchange.com ? That's generally where I ask questions about design patterns. The topics you can ask about there are more in line with your question.
    – e_i_pi
    Commented Apr 26, 2021 at 22:41
  • 20
    Not an answer for how to not get flagged, but if it suits your purpose, take a look at Code Review SE. From their help page: "If you have a working piece of code from your project and are looking for open-ended feedback..." within their guidelines of course
    – Booga Roo
    Commented Apr 26, 2021 at 23:47
  • 3
    (And even in the real world, "clean" is subjective: "It's not clean unless its Pine O Clean" :-) )
    – Stephen C
    Commented Apr 27, 2021 at 3:15
  • 6
    Ah, brand new day! I didn't get the best night's sleep but it could've been worse. I wonder what Stack Overflow is up to this fine morning... oh, no big deal, just hyperfixating on a single word in an otherwise clear and on-topic question as usual (the question is getting new close votes once again since it was reopened just a short couple hours ago, after this meta post).
    – BoltClock Mod
    Commented Apr 27, 2021 at 4:34
  • 12
    @Booga Roo: Honestly, I could probably get away with migrating this question to CR as is without any further changes. But if the word "clean" is literally stopping people dead in their tracks from reading the remainder of the question, I might have to get rid of it somehow. The irony of sterilizing questions by removing words like "clean"...
    – BoltClock Mod
    Commented Apr 27, 2021 at 4:42
  • If we can discuss whether it's a suitable question or not (and it seems that we can), then it should be a suitable question. Anything else is really hard to explain.
    – barfuin
    Commented Apr 27, 2021 at 18:54
  • Boom! opinion-based question detected :-)
    – Veverke
    Commented Apr 29, 2021 at 14:33
  • @BoogaRoo The question would probably be on-topic on Code Review. However the question is abnormal for Code Review. So could trigger some 'looks off-topic vibes'. Additionally answerer's on Code Review don't have an obligation to answer any questions in the post. So whilst the post could be on-topic and 'answered' the OP's question may be left unanswered. "Feel free to call attention to specific areas you are concerned about (performance, formatting, etc). However, any aspect of the code posted is fair game for feedback and criticism."
    – Peilonrayz
    Commented Apr 29, 2021 at 19:44
  • @StephenC in English everything is subjective. Ask a mathematician what they think about the law/court's burden of 'proof' (balance of probabilities/reasonable doubt) vs their own understanding of 'proof' (basically, guaranteed to be correct).
    – mcalex
    Commented Apr 29, 2021 at 21:00
  • @mcalex - Did you see the " :-) " ?
    – Stephen C
    Commented May 1, 2021 at 6:44

3 Answers 3

14

I agree with @Makoto, that simply asking for "cleanliness" is a clear sign for an opinion-based question in many cases. However, I don't think that this necessarily holds for the current revision for your question, although it can still use some improvement.


Let's take a look at the first revision:

So this works and it does what I want it to do but I would like to think that there must be a better way to achieve this so that the DI Engine can provide what is needed without me having to help it. If anyone knows a better way to do this please let me know. Thanks

Here you are asking for a "better way", without really specifying what "better" means for you. Also the question lacks detail, as it is not immediately clear what that "what is needed" is which the DI engine should provide.

The second revision is much clearer:

So this works and it does what I want it to do but it's not very clean. How do I: Add the security element using the DI engine without having to extract the parameters from the service container and new'ing up a new instance of the class?

I don't think that this asks for "opinions" now. You show that you have a working solution, and that it somehow (see below) does not fit your needs. You then explicitly state what kind of solution you are looking for.

I believe that this question is clearly answerable (although I admittedly don't know the answer right now, without doing some research myself), and thus voted to reopen.


However, there is still some room for improvements: Your question is rather long, and it was difficult to immediately spot the actual question.

  • It may help to restructure your question, e.g., by first briefly stating the problem and defining the desired solution, and then giving details on your own solution.
  • You still don't say exactly what is wrong with your current solution, just that it is not clean. It may help to list the exact issues you'd like to have resolved, as "clean" is a rather subjective term.
  • You may want to use some formatting to highlight important points, and convert the long enumeration ("So there were three problems here") into a Markdown list. This allows the reader to scan your question more efficiently, without getting lost or missing important bits of information.
2
  • 9
    In my mind, the edited question still raises the question of why OP doesn't want to do things a specific way - what problem would be solved by doing it differently. Creating the class instance seems straightforward enough; if the goal is to avoid boilerplate, then it would be a good idea to state that explicitly. Commented Apr 26, 2021 at 22:55
  • 3
    I took out the "clean" part and reworded like this. "So this works and it does what I want it to do but it's not done in a way that represents Microsoft best practices. (See linked article above.)"
    – Randall W
    Commented Apr 27, 2021 at 12:28
26

Definitely not a C# expert, but this is what sticks out to me as a red flag:

So this works and it does what I want it to do but it's not very clean. How do I: Add the security element using the DI engine without having to extract the parameters from the service container and new'ing up a new instance of the class?

"Clean" is a matter of perspective and is a matter of context. What someone considers "clean" is something that someone else considers a code smell.

The entire question then feels like it's built on this house of cards in that you want some desired state of "cleanliness" that may or may not exist in someone else's mind.

So this could be the crux of the problem. If you don't like this, then you'll want to ask an explicit and direct question as opposed to one that's opinionated like "cleanliness".

2
  • Uncle Bob has polluted our space. There are also associations back to the 1930s Europe. Commented Apr 28, 2021 at 11:47
  • @PeterMortensen: I really don't make any reference to that. I'm thinking in a more practical philosophy of clean (e.g. my sister often calls my place "bachelor clean" whereas I think of it as normally "clean"). Clean code is subjective; it always has been and always will be, and that's the point I wish to drive home.
    – Makoto
    Commented Apr 28, 2021 at 15:47
6

One thing that might help: Clearly ask the question at the beginning of the post, and then provide the supplemental material explaining what you've tried. This makes it more obviously a question with an objective answer (which you supplied), rather than appearing to be a statement of opinion as to specific methods of coding.

You must log in to answer this question.

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