This question was prompted by this SO question
It's a classic example of a "paste in requirements and ask for working code to solve it" (typically such questions are homework, but not always).
Firstly, do we all agree these questions are off topic?
Secondly, if they are, how to close, because none of the current options are a good fit, and this situation comes up fairly often - often enough to warrant its own reason.
Currently, these questions just get down voted and commented with various "what have you tried" and "this is not a coding service" type reasons. Enough down votes lead to closure, but why not close it with a clear reason, giving the OP a chance to bring it on topic.
I propose another close reason, something like:
Questions asking us to write code for your requirements are off-topic for Stack Overflow as they are not about solving a specific problem with code, but rather are asking the community to do your work for you. Instead, make an attempt at writing code and if you encounter a problem, narrow the question to that specific problem and show what has been done so far to try solve it.
Comments? Thoughts?
To narrow this context of this question, I am not talking about narrowly focused "knowledge-based coding technique" questions that don't have code simply because the OP just don't know what line to write, or often just what method to call. For example:
How to convert a String of "bits" (1 and 0 characters) conforming to IEEE-754 to a primitive
double
in java?
The OP rightly senses there must be a standard/best way of doing it, and is asking for narrow guidance/advice. IMHO, such questions are of high value.
No, my question is about "whole program" type questions, where the OP typically pastes in CS coursework requirements (I have even seen done as a screenshot) that define the desired behaviour, input and output formats and even edge cases. For example:
Write a program that asks a user for her birthday, then displays the number of days she has been alive, the number of days till the next birthday and her current bio-rhythms. Reject birthdays that are more than 100 years ago or in the future. Blank input ends the program.
Why the current reasons don't apply (well):
- Duplicate (maybe, but not relevant to this question)
- Unclear what you're asking - nope. It's crystal clear
- Too broad - nope. The question is narrow enough that there would be very few "good" answers
- Primarily opinion-based - Possibly, but this doesn't capture the problem here
- Off-topic because
- general computing hardware and software - nope
- professional server- or networking-related infrastructure administration - nope
- a problem that can no longer be reproduced - nope
- why isn't this code working? - no code at all is a degenerate edge case of this reason. No code does nothing, so of course it won't work
- question belongs on another site - maybe, but SO seems the best fit
So then... what reason should we give these?
dmwfm.stackexchange.com
site, then the "question belongs on another site" close reason will be appropriate.