Can one ask questions about homework here on Stack Overflow? If so, how should I go about doing so?
What guidelines should users follow when responding to homework questions?
Can one ask questions about homework here on Stack Overflow? If so, how should I go about doing so?
What guidelines should users follow when responding to homework questions?
The community has mixed feelings about homework questions. While some feel that students should be able to get an answer to any question they want to ask, others feel that Stack Overflow is not a place for homework questions at all.
This is an attempt to reconcile these two extreme positions in a way that is acceptable to the majority of the community. Note that this post is not the official position of the Stack Overflow administrators, but rather a community-edited effort to provide clear guidelines on how to respond to homework. Individual community members should, of course, use their own judgment.
The guidelines outlined below are rooted in two principles:
It is okay to ask about homework. For one, it would be impossible to stop it all, even if we wanted to. Stack Overflow exists to help programmers learn and provide a standard repository for programming problems, both simple and complex, and this includes helping students.
Providing an answer that doesn't help a student learn is not in the student's own best interest. Therefore, you might choose to treat homework questions differently than other questions.
Make a good faith attempt to solve the problem yourself first. Users here respond negatively if your question gives them the impression that you're asking them to do your work for you. On the other hand, questions that ask about a specific issue that you're having a problem with usually receive a much better response.
Ask about specific problems with your existing implementation. If you can't do that yet, try some more of your own work first or searching for more general help; your professor is likely to be a better resource at this stage than Stack Overflow.
Search for already-existing questions about your issue. Try using both the Stack Overflow site search and your favorite search engine. Most search engines allow you to limit results to a single site. For example, you can search Stack Overflow on Google. Definitely try searching for your title and/or the keywords in your title, along with the language tag for the language your question is working with. Look through at least the first several results. People tend to respond negatively if they can easily find a duplicate to your question, particularly if they can do so by just searching for your question's title...
Help us understand your baseline. Broad pleas for help like "I have no idea where to start" are problematic, because we can't know your starting level. If you are new to programming, or the specific programming language or system platform you are trying to use, and can't even write or run a simple "Hello world" program, concentrate on solving that in isolation, and return to your actual assignment only when you have solved that. Past that point, it might help to explain the purpose of the course or mention topics you have been taught recently. Do you know how to assign a value to a variable? Do you know how to loop over a range of numbers? Tell us what you already know, and tell us what you already searched for or looked at, and why those resources were not helpful for you.
Be aware of school policy. If your school has a policy regarding outside help on homework, make sure you are aware of it before you ask for/receive help on Stack Overflow. If there are specific restrictions (for example, you can receive help, but not full code samples), include them in the question so that those providing assistance can keep you out of trouble. Note that vandalism and/or edits to questions that invalidate existing answers are against policy. Attempts to hide your question after you've received an answer will not be successful and will make it harder for you to get answers to future questions. See also: I've rethought my question about a homework assignment—why can't I get it deleted?
Never use code you don't understand. It definitely won't help you later (after school, in later assignments, on tests, etc.), and it could be, at best, very embarrassing if you are asked to explain the code you turned in.
Understand the difference between "asking a question about your homework" and "asking a specific question about the code in your homework". You should never ask a question about your homework, because more often than not, it will not meet the recommendations in the rest of these guidelines. Instead, ask about the code you wrote to solve your homework problem and be specific with the inputs, desired outputs, and error messages. It is ideal if you take your code and create a minimal, reproducible example instead of pasting your entire code, especially if it is a long code block.
Try to provide an explanation that will lead the asker in the correct direction. Genuine understanding is the real goal for students, but trying to provide that is usually appreciated for any question.
Focus on the explanation rather than providing full source code. A student is more likely to learn from clear steps and proper explanation rather than ready-made code. However, if a code example will help understand the solution, don't stop yourself from providing one.
Recognize that homework is likely to include artificial constraints, and honor those constraints. Also, be aware that these constraints may affect whether a question should be closed as a duplicate. That said, there is nothing wrong with also including information in your answer about how the problem would normally be solved in the real world. It's helpful for students to learn real-world patterns, and this also makes your answer more useful to future readers.
"Lack of effort" is not a reason to close questions. If a homework question shows no good faith effort, you may cast a downvote and refrain from answering, but this is not—in itself—a close reason. (Obviously, if the question does not ask a question, is unclear, does not provide sufficient information to allow it to be answered, and/or answering it would require writing an entire book, then it should still be closed for the appropriate reason.)
Failure to comply with these guidelines is not a reason to downvote an answer. Naturally, if the answer is incorrect, low quality, poorly explained, and/or something that you would downvote anyway, then it is fine to do so. Remember that it's not always obvious at first glance that a question is homework, especially when you're not expecting to see it here. You can, according to your judgment, leave comments on the answer with suggestions on how to improve it.
Don't ridicule a student because they haven't yet learned something obvious or developed the good habits you'd expect from a seasoned programmer. Do add a respectful comment or answer that points them towards best practices and better style.
It's okay to ask if a question is homework if it would help you write a better answer, but always be polite.
FWIW, I teach a programming class, and have the following policy:
Programming is a "team sport," and it is good for you to talk with each other about ideas on how to confront the problems, and look to the Internet and other sources for ideas.
Nevertheless, the work you hand in with your name on it should represent work that you did.
If you work with others to complete your lab, list those people with your source code. Also, if you get code from an online resource, list the URL with the lab, and credit where you got the code from. This is a common courtesy and a legal requirement, even for free, open-source software.
Failure to give credit is plagiarism. Work that is apparent plagiarism may receive little or no credit.
user contributions licensed under cc-wiki with attribution required
. If you take something non-trivial from here and use it verbatim in your own work (whether as a student or otherwise) without attributing it correctly to the author and to SE then you would be in breach of that licence, would you not?
[Open letter to students with homework problems](https://softwareengineering.meta.stackexchange.com/q/6166)
[How do I ask and answer homework questions?](https://meta.stackoverflow.com/q/334822)
(Please do not delete this comment again!)