0

Sometimes we see questions are about write code for me. The question does not show efforts.

We should downvote it, and leave comments to notify the author to improve their question, sure. But should we answer it if we happen to have the knowledge?

2
  • 8
    IMO, you shouldn't. DV, flag, move on. Answering may end up "protecting" a bad question from when the roomba comes around.
    – yivi
    Commented Mar 10, 2017 at 13:54
  • Define "should". "Should" from the standpoint of the StackOverflow mission? "Should" from the standpoint of spending your time wisely? "Should" from the standpoint of helping out humankind?
    – user663031
    Commented Mar 12, 2017 at 5:17

1 Answer 1

4

No, you shouldn't be explicitly writing code for someone. Part of the posting rules/guidelines states that you should at least provide some code to show why the problem is occurring and what you've already tried.

Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire program! Not only is this likely to get you in trouble if you're posting your employer's code, it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines:

  • Include just enough code to allow others to reproduce the problem. For help with this, read How to create a Minimal, Complete, and Verifiable example.
  • If it is possible to create a live example of the problem that you can link to (for example, on http://sqlfiddle.com/ or http://jsbin.com/) then do so - but also include the code in your question itself. Not everyone can access external sites, and the links may break over time.

How do I ask a good question?

Rewriting code so it works though, that should be fine.

That way we're providing meaningful help to solve a question without doing all of the work first. Once we know what the person asking is after and that they've tried X and it doesn't work, then we can write the code so that it now does work.

1
  • 3
    This is completely false, and a blatantly incorrect interpretation of the quoted text.. Only debugging style questions explicitly require code.. If you're closing questions solely because they don't contain code, you're doing it wrong. Is the question on-topic and answerable in its current state? If so, and it is not a duplicate, answer it!
    – user4639281
    Commented Mar 10, 2017 at 15:34

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