Is there any way to post my code on Code Review Stack Exchange and not be worried about plagiarism?

In addition to all the good answers you received so far, I should also point out that in general people's fear of being unethically scooped is vastly exaggerated. I would imagine that there really isn't a community of people scouring the Web for master's thesis level research that they can find and then, with considerable time disadvantage to the original author, copy. I say "with considerable time disadvantage" because even if somebody finds your work, they still need to reverse engineer a lot of what you already have and know to get to a publishable thesis or paper from your code alone. Unless you consider letting your work sit for half a year it seems unlikely that a copycat will end up publishing quicker than you, the original author.

Yes, being scooped sucks, but it usually does not happen because somebody stole your code, or even your idea. Scooping happens because there are multiple independent teams working worldwide on almost any mainstream research topic, and there usually only are a finite number of ways to attack any given problem given the current state of literature. Situations where two teams are working with similar approaches on similar problems are bound to come up.


Posting code on the Internet is somewhat like posting a preprint¹. Everybody can see it, use it, and be inspired by it, and that’s fine if they reference you as the source of this, but of course somebody can also come along and claim that they had the same idea independently and rush a publication before you (which would constitute plagiarism if they hadn’t). Even if the latter happens, you can still refer to your time-stamped post/publication to establish priority and to get at least a piece of the credit cake.

There is one major difference though: In fields where preprint servers such as the Arxiv are properly established, plagiarisers may not be very credible when they claim that they were did not know of your prior publication. Being oblivious to something posted on Code Review, on the other hand is always a plausible claim – unless the plagiariser left a trail interacting with your post.

Some other factors to consider:

  • How much of your result is contained in your code? At least for my work, any piece of code reasonably fitting into a Code Review question at most gives you a hint of the bigger picture. If the same applies to you, it is extremely unlikely that somebody sees your code, recognises its relevance, and rebuilds the rest of your work around it.

  • How easy is it to rebuild your work from your code? For example, if you spend a considerable time figuring out the value of some parameter (and do not give it in your example or modify it), somebody else would have to reiterate everything leading to your parameter. Also consider that if a considerable amount of creativity, research skill, and subject knowledge are required to rebuild your work, somebody able to do this can also produce original research with less effort and risk.

  • How narrow is your field? If only a small community can appreciate and plausibly reproduce your work, it also needs somebody from this community to recognise and plagiarise your work from your code.

  • How relevant is your result? Given that we are talking about a master’s thesis, it is unlikely to be very big. Of course, it’s not impossible, but you can judge yourself from the feedback you should have received from your supervisor. The less attractive your result, the less likely it is for somebody to take efforts and risks in plagiarising it. Again, most researchers probably have better things to do, e.g., performing their own research.

¹ Also see this question of mine regarding the plagiarism of pre-prints.


In code reviews, you kind of need to know what the goal of the program is, otherwise the people looking at your code are essentially just 'human linters'. So depending on the type of feedback you want, you might have to explain a bit what your code is doing.

So the core issue would be that you are explaining your idea, and someone else can run with it. Well, it's the internet, if you make it public there is no way of knowing what people are going to do with it. You could indeed just ask for simple code verification (syntax, naming, obvious errors) but without context they can't verify if your code does what you think it does (helpful part of a code review).

If your degree isn't purely in software engineering, they might not really care if your tool is written in an 'optimal way' though. Best bet would be to keep it offline then, or ask some friends whom you trust to review your code (through private github gists for example).

One other solution would be to read up on some material regarding code quality. Code Complete2 is a good start. Other than that, check out C++ code on github from larger projects (Unreal Engine for example). If you find it valuable to write good code, this will help you more in the long run ;-)