# Homework Questions

We may soon see questions that are really part of somebody's homework.

Given that this site is about advice and critique that can go as far as providing complete code alternatives should we be wary of doing people's homework for them? Can we tell the difference?

I think the consensus on this one then needs to find its' way into the faq.

• Here's our official first homework question. Let see how it goes :P Jan 31, 2011 at 9:46

I can imagine basically three types of homework-related questions that might be asked:

1. I have this homework, how do I do it?
2. I have written this code as part of my homework assignment. Are there any obvious problems with my design or can it be prettified/optimized in any way?
3. I have written this code as part of my homework assignment. Is it correct?

The first one is off-topic here simply because "How do I do this?" questions aren't in scope for this site - whether it's homework or not.

The second isn't problematic because in that case the person has already done their homework and we're just helping them to do it better. In my experience programming assignments are graded on correctness, not code quality. So we're not helping them to get a better grade for the assignment - we're just helping them to improve their programming style.

The only one that seems problematic is the third because if we fix the person's code for them, we help them get a better grade than they'd have gotten otherwise. On the other hand if they already have almost-working code, they might have gotten an okay grade anyway.

• I'm not quite so sure as you about the way grading goes but 'twas many years ago for me ;-) If indeed we can help / teach without artificially inflating someone's grade then great. I'm just concerned that we may be open to doing people's work for them.
– LRE
Jan 20, 2011 at 6:14
• I don't know, I'd imagine if a teacher was on the fence on whether to grade an assignment with an 'A' or a 'B' -- code quality could make all the difference there. When I first started programming, my code was pretty bad. I remember my instructor writing comments on my assignment like 'Yuck!'. Jan 20, 2011 at 8:51
• Fixing code is an SO problem. I'd say the second reason is the only one on topic here. Jan 20, 2011 at 14:13
• I agree that the second case is the only one we should address here. I don't see it as problematic because the purpose of this site is to help people become better developers by writing better code. If this happens to give someone a better grade, so be it. Generally responses don't rewrite entire chunks of code, but give recommendations for improvement and examples of how to rewrite small sections. This is no different than what someone will get at on-campus tutoring labs. Feb 12, 2014 at 22:54

I think that there is a fine line between code completion and code optimization!

take this theoretical question:

For an assignation I have create this basic class:

class X
{
public int A(int ret)
{
return ret;
}

public int Y(int Z)
{
return this.Z(Z) * this.A(2);
}

public int Z(X)
{
return (X * 10);
}
}


Is there any minor adjustments that I can make to make the code smaller.

Now the above is a very basic sample question but can easily be answered, as long as the OP has completed to original code before hand I think the the we should be able to suggest ways to make the lighter and more stable.

Such As:

   public int Y(int Z)
{
return (Z * 10) * 2;
}
//And remove the other methods.


When an answer is provided it is not only provided for the OP but for everyone who requires such answer and comes across the thread, therefore I think it would be OK to help improve code effectiveness, style, functionality but never to generate new code for the OP.

I think you'll be able to tell when someone is asking for homework help. If they want their code to be actually be reviewed, they probably won't be asking "Um...how do I do this?", they'll be asking "I know how to do this - but how can I do it better?". On SO it's usually quite obvious, at least.

Of course, on a website where the whole goal is [as I understand it] to provide people with feedback and optimized code, there's no doubt that a lot of people will be asking for homework help, so I agree that it should definitely be in the FAQ that people aren't here to do your homework for you.

Homework help belongs on SO, anyways. :P

1. Moderators or users with sufficient reputation could tag a question homework.

2. Try not to put entire code examples that answers a question. For example it should be easy to spot something like "How do I" and "Does anyone know"? I think a good give away is if there is no code sample in the question itself.

• I think questions that start with "How do I" or "Does anyone know" are pretty clearly off topic whether they're homework-related or not. Jan 21, 2011 at 14:20
• @sepp2k - yeah good point! :) Jan 21, 2011 at 14:20