What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

A recurring pattern in homework questions is something like this:

  • OP -- I need to do X.
  • Answer -- Then you should use Y.
  • OP -- I'm not allowed to use Y.

Here's one example. and another.

On the one hand, it seems that it would be most valuable to document the best solution to the problem, regardless of the arbitrary constraints of the homework assignment.

On the other hand, it is theoretically possible that one could be faced with similar constraints in a real-world situation, and it would make sense to document how to deal with them.

share|improve this question
We're not here to answer homework questions. –  Josh K May 13 '10 at 14:50
@Josh: We are here to answer questions regardless of the origin. If you don't like answering homework questions, that is up to you. –  IAbstract May 13 '10 at 17:00
So you also wouldn't object to people asking the community to write code for them? –  Josh K May 13 '10 at 17:04

2 Answers 2

up vote 2 down vote accepted

I see parallels between this question and these:

...but there's enough of a difference to warrant a bit further discussion.

This isn't exactly black-and-white. A number of different factors play into this:

  • Are you sure it's a homework question? Is it actually tagged homework?
  • Are the reasons against using a particular solution discussed?
  • If the reasons are discussed, are they valid? (Arbitrary restrictions on homework are valid.)
  • How inferior are the alternatives? Are they actually dangerous, or just tedious/inefficient?

There's a tendency to want to spite people who ask homework questions without tagging them as homework. I admit it, it annoys me too. But it's equally possible that the restriction is the result of some clueless micromanagement, and as responsible users of the trilogy sites, we need to either answer questions properly or not answer them at all (leave a comment instead).

I personally have done all of the following:

  • If a question says, I can't use X, without any further information, and it's not actually tagged homework, then leave a comment, why can't you use X? Sometimes the author is actually operating on a mistaken assumption; find out what that is before going any further.

  • If reasons are given (or determined from comments) and are questionable or make no sense, then you have a choice. If you can provide a quick explanation or link for why the decision should be revisited, it's better to do in a comment. But if it's going to take a long time to explain, there's nothing wrong with contributing an answer to that effect.

    Yes, other programmers who have similar restrictions might land on the question and be helped by literal answers, but there might also be other programmers who have imposed those restrictions on themselves due to the same faulty logic, and those people will be helped by a well-written answer explaining why the decision is a poor one.

  • If the reasons are technically sound (including homework instructions), but the restrictions pose serious problems - let's say it's requiring a password to be stored as plain text, or is based on a horrific database schema - then answer the question and add a caveat/disclaimer. Explain that the solution you provided will work but is not appropriate for production use (usually in bold text to call attention to it, like I just did).

  • If the restrictions seem silly but aren't actively harmful, then leave it alone. Or, if you're answering the question (within the framework provided) then you might add a comment or postscript mentioning that the "prohibited" solution is actually the best one for reasons Y and Z. But don't waste too much time or space on this, because there's a very good chance that the author and any future readers are already aware of it.

share|improve this answer

I think restrictions on homework questions should not be any different than restrictions on any other question. It's preferable that they include the restriction in the question, but I don't think people should ignore restrictions. If a question does have a restriction but it is not in the question body, then it should probably be edited in to state this.

If I ask a question for solving a problem, but I cannot use a certain technology, then a best solution that uses that technology really isn't useful to me or anyone else who is similar restricted. Homework questions shouldn't be exempt from this kind of respect. Once the question asker has established the presence of a restriction, it really is bad taste to promote something which they are barred from using (as opposed to if they were just looking for alternatives).

With Regards to Arbitrary or Poor-Design-Imposing Restrictions

A restriction being arbitrary versus practical should not affect your choice to respect it: the user still has to deal with the restriction. You might be able to argue against your employer's arbitrary restriction of useful tools, but at the end of the day he still commands your paycheck, not unlike the teacher who commands your grades. So you should honor arbitrary restrictions the same as you do any other restriction.

Let's expand an example on homework questions with restrictions. Suppose Alice has a homework question about implementing a certain function in Java. She posts it without a restriction at first, but then is told that there is some wacky restriction that her teacher has enforced which prevents her from solving it in O(n) time. So she edits her question, changing absolutely none of the content except for stating that she is restricted from using this method that would be faster. If you compare the two questions, the presence of the restriction doesn't really change the nature of the question, all it does is change what is a viable answer. Whether it is a good homework question (see some guidelines) that should be answered does not change from this. So the fact that a question with arbitrary restrictions is a homework question should not affect how you honor the restriction.

Bob is free to answer Alice's question stating the method which would solve it in O(n) time, provided he also gives the method which respects the restriction. If he didn't know how to solve it with the restriction in place, he can place it as a comment to Alice's question. There, people who come to the question will still see that the restriction is arbitrary and Alice's teacher is mean, and Alice doesn't have to deal with a useless answer. Learning is good, but never forget that the ultimate purpose of the site is to solve problems.

share|improve this answer
But sometimes homework assignments might promote bad practice. In those cases you should probably say "Do X to comply to restrictions, but in reality you should do Y". Homework questions are different in that they're about learning, so it's a good opportunity to teach. –  Bob May 13 '10 at 15:25
@Bob: I agree. Homework questions (and tutorial samples/lesson) do not always promote the best habits & practices - only to get a point across and teach something. –  IAbstract May 13 '10 at 17:03
Remember also that these problems are not necessarily about learning a coding language, but also about problem solving, critical thinking, etc. –  IAbstract May 13 '10 at 17:05
This, plus a note that it's sometimes useful to call out the restriction for what it is: damaging and unhelpful to the overall quality of the program and productivity of the programmer. Still honor the restriction in the answer, but let the asker know that there is also a better way. –  Joel Coehoorn Apr 27 '12 at 21:54

You must log in to answer this question.

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