I wrote source code for an assignment. After I was done and the program was functional, i uploaded a piece (a class) on the Code Review SE and people gave me advice, which I then implemented. Should i credit them, and if so, how?

For pieces of code I took from Stackoverflow, for example, I would write it in a comment next to the code, and include a link.

Should this be done in the same way for improvement suggestions? In my concrete example, implemented suggestions were mostly about programming language intricacies and object orientation. Another option would be to inform the professor in advance and/or ask about this being allowed.

EDIT: The assignment ist not about the programming languages or object-oriented design.

  • 28
    When in doubt, cite.
    – JeffE
    Jul 24, 2018 at 12:20
  • 1
    @yes, and I think the TA will appreciate your honesty (I certainly woulda when I was a TA).
    – user189035
    Jul 24, 2018 at 17:51
  • @JeffE says who? Jul 24, 2018 at 22:11
  • 1
    ISWYDT @TasosPapastylianou
    – JeffE
    Jul 24, 2018 at 23:51

2 Answers 2


Yes, you should ask the professor in advance and make sure he/she understands what CodeReview actually is.

More generally, you should know (and the professor should effectively communicate) what the parameters are for seeking help. I have doubts that very many professors would permit it, but some would.

The reason for assignments isn't because the professor needs the result. It is to cause a change in your brain that won't happen if you take very many short cuts.

Seeking help from the professor or an assistant is different, since they know the actual purpose of the individual assignment (in your learning) and can give hints that won't impede your learning, but help you deepen it. The contributors to CodeReview don't have the context (or usually the background) to do that properly. So you may be sabotoging your learning in pursuit of a better grade. Long term that's a losing game.

Making it functional first was a good step, but there is a lot to good programming beyond functional.

And if you haven't done so, then yes, mark it and point to the source of help. If there weren't already rules around the behavior there should be no reason to punish you and you might get better advice about seeking help from the prof. In fact, you should make the note pretty visible so it just doesn't get lost. Program comments may not be read without some statement at the top pointing to them.

  • 14
    I don't see how soliciting help from the Code Review hurt the OPs learning. The OP had working source code, he got ideas for how to improve it, and he implemented the ideas. Thus, he had already performed the work that was required for the course. By sending the code to Code Review and implementing improvements, he learned ways to improve his code. Jul 24, 2018 at 12:23
  • 4
    @PeterShor My answer isn't about grading and it isn't about fairness. It is about learning. I hope you aren't suggesting that "getting a program working" is enough. Much of the learning about programming is getting it clean, readable, testable, etc etc etc. Learning doesn't stop the first time a program runs.
    – Buffy
    Jul 24, 2018 at 12:32
  • 3
    @JonasSchwarz, what was it about, then?
    – Buffy
    Jul 24, 2018 at 12:50
  • 3
    @PeterShor it makes me sad that you are probably correct. But I'm not just talking about "advanced" programming. If bad habits are learned early they become ingrained. As the first hard issue students will fall back on their bad habits. Do it right - from the beginning. Otherwise, why bother?
    – Buffy
    Jul 24, 2018 at 13:40
  • 3
    @Accumulation: if you had read my second comment, you would realize that you are completely misinterpreting my views. I was specifically disagreeing with the answer's sentences "So you may be sabotaging your learning in pursuit of a better grade. Long term that's a losing game." I totally agree that the student should inform the professor that he obtained help from CR. Jul 24, 2018 at 16:10

Other than taking a few seconds out of your life, the only reason to not mention it is if you think that your instructor would take points off for it. If you're withholding information that you think would affect your grade, that's dishonest. If you disclose it, the worst your instructor can do is mark off points. If you don't, and your instructor finds out about it, they could theoretically accuse you of plagiarism. Citing sources isn't, as many people seem to think, a protection against copyright claims, but it does immunize you against plagiarism claims. If your instructor hasn't given you instructions on citations, you don't need do to anything more than mention that you had your code reviewed on an online forum and that your instructor can ask you for more details if they wish.

Something labeled a take-home "exam" or "test" would be different from something merely labeled an "assignment"; an exam is designed to inform the instructor of your knowledge level, and there is much more of an implied honor system. If there is confusion as to what that honor system consists of, that should be clarified before working on the test. An assignment is an opportunity to practice and to expose to yourself any areas of not understanding before you're actually tested on it. Since the main beneficiary of it is intended to be you, not the instructor, there is less urgency in clarifying the rules prior to working on it.

You must log in to answer this question.

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