As for "spoiling" newbies, I too am quite new at this stuff (i've only been learning C++ for nearly 3 months now) and I got as far as I have by studying other people's examples and solutions, in the same way that I am helping others in here now.
Hmm, so if you're a newbie, you hand them some code that may not necessarily be correct or using proper coding practices, and say "here, learn from this," what do you think that is going to teach them, even if they do study and try to learn from it?
As I also mentioned in that, there are many ways to solve a problem, I just give one which i believe is best. Now, if the person that gets this code decides to simply take it, copy it and give it in as his/her own work without at least making the effort of understanding it, that's their problem in the sense that they will most likely fail their written exam or get caught in the act. I have absolutely nothing to lose;
Yes,
you have nothing to lose, but what about the newbies? Do you think if we handed code to every single person that was having trouble, they would study it? If we actually try to explain things to them and not simply say "learn my example", they will perhaps
learn how the code works, and then when a test or exam comes, they will do well!
instead I like not only taking these programs and solving them as a test to myself, but I also like making other people happy and calming them down after the agonizing hours they've already spent trying to solve their problem.
Which do you think will help them remember better: if they've spent agnoizing hours on it until someone finally explains it and it makes sense, or if they've just been dumped a pile of code and said "here, have fun"?
I, for one when learning, almost never forget the stupid mistakes that I make at first if I spend a while trying to solve them. When programming in C++ now, it's very rare that I mistakenly forget to put a semicolon at the end of my sentance.
I just want to make it clear that I am not trying to give people easy solutions to their homework, I am not trying to get anyone in trouble.. I just give them a method for easier studying (if they want it).
Programming boils down to 2 things: experience and discipline. These 2 can only be gained by actually doing the work, and not studying someone else's code. By giving them complete, working examples, you keep them from doing these things. For example, if you had never coded before, but had seen and studied C++ for several years, would you recognize compiler errors?
Probably not. They can be somewhat cryptic and confusing, and it takes experience to know what each message means and what is wrong with your code. Also, coding experience helps you prevent errors from happening, as you get into a routine of placing a semicolon at the end of each statement, etc, etc.
So, although someone *might* actually try to learn from the code you give them, why not actually explain what it does? Coding books are not made entirely out of code; they have text to explain what the code does. And although you say "the student can do what he wants with the code," the disappointing fact is that it's almost like placing a little kid next to a cookie jar and saying "don't eat the cookies inside". Take away the temptation, and the student won't do it. You may actually be saving them from failing the class by not handing them their assignments.
I'm with Mr. ~s.o.s~ on this one.