I am taking a graduate machine learning course and am working with another student in the class on a final project. In his undergraduate studies, the other student wrote code that accomplished a similar task, and mentioned in our previous meeting that we would be able to leverage much of this code for our current project if we wanted to. I responded that I believe it would constitute textbook cheating and self-plagiarism, but the other student disagrees and believes that re-using the code would not constitute self-plagiarism because he himself wrote it, and it would be redundant to re-write what he had already done.

Now, the course instructors have made it clear that we are not allowed to use any external libraries to perform certain classes of algorithms for this project. This students' prior code would fall under this category of prohibited tools, but he claims that it doesn't qualify because he wrote the code himself (so it is not an "external library"). I believe this is hyperbole, but he disagrees. It is also worth mentioning that this code is licensed under an MIT License, though it is not widely used at all.

It has gotten to the point where I am uncomfortable going forward with the project by re-using his old code, and he does not want to do work on the project that he considers to be redundant. My worry is that if it turns out we're not allowed to reuse the code, then using it could cause us to fail the course and severely negatively affect our reputations. Even if we don't get caught, I personally feel that it would be unethical to copy-paste old code and present it as though it's fresh code for this current project.

I am unsure of how to proceed. I have tried reaching out to the professor of the course some time ago (she has been traveling for some conferences recently and will be for a while) but I have not heard back from her. Additionally, the course TAs have been unwilling to weigh-in on the situation.

I have the following questions:

  1. Is the above situation usually considered to be self plagiarism? Why or why not?
  2. Is the above act typically allowed in an academic setting?
  3. Assuming you are in my position, and consider re-using the code to be cheating and/or unethical, what is the best way to proceed; both in terms of how to make progress on the project, how to compromise with my group mate, and how to protect myself if my group mate refuses to budge.
  • 67
    Among other reasons, you've made this very strongly moralistic for something that's at best an edge case.
    – Fomite
    Nov 1, 2015 at 1:00
  • 53
    Part of the problem is that self-plagarism is somewhat ill-definined, especially for something like code. That's part of the problem - you've drawn some very sharp lines and started throwing around some very moralistic language around something that's at best ill-defined.
    – Fomite
    Nov 1, 2015 at 1:05
  • 16
    If you are uncomfortable working with someone because, in your judgement, they are dong something unethical that may entangle you, then stop working with them.
    – JeffE
    Nov 1, 2015 at 3:15
  • 57
    I think you are getting answers that aren't what you were looking for because the way the question is phrased is not really accurate. A "classmate who refuses to acknowledge self plagiarism" would be one who wants to hide the fact that the code is reused, or who insists on using it even after you hear back from the instructor that it's not allowed. What you have here is a classmate that disagrees on the interpretation of the rules of the course, which is a completely different question. I think an edit to the post is in order.
    – ff524
    Nov 1, 2015 at 8:21
  • 22
    @LightnessRacesinOrbit While I fully agree that the OP is overly moralistic about the point, you can in fact plagiarise yourself, although admittedly it doesn't really apply to OP's case.
    – March Ho
    Nov 1, 2015 at 13:47

9 Answers 9


What should you do? You should ask the professor politely and without imposing your pre-judgement on whether this is or is not prohibited by the rules of the class. You are not in a position to make this judgement. The only person who can give a definitive ruling is the professor who set the rules.

I recommend an approach like:

My teammate has previously created code that would be very applicable to this project. Can we use that code, or does it count as an external library, and we should instead write it again as an exercise?

While you are waiting for a response, I would recommend proceeding in two ways in parallel:

  1. You implement a new version of the library from scratch, while
  2. Your partner builds upon the existing library.

That way, you get the educational value of building the library, rather than using the pre-existing library, and your partner can push on ahead without either of you being stalled while waiting for the result.

  • 17
    I think suggesting to rewrite it is a bit silly. First off, whats the stop a giant ctrl-a, ctrl-c? If my goal is to rewrite something I've written before, I'd hardly call that plagiarism. Second, whats the benefit of actually rewriting it? Just so you can check some mental checkbox? Nov 1, 2015 at 22:59
  • 20
    @DavidGrinberg The answer suggest that the OP rewrites the code, not his colleague who originally wrote the library. That's reproducing someone else's results and in most cases a good learning experience.
    – silvado
    Nov 2, 2015 at 8:47
  • 3
    Additionally, the OP might come upon optimizations while rebuilding the library so regardless of whether or not it's plagiarism it's still going to have an educational value
    – Cronax
    Nov 2, 2015 at 13:13
  • 6
    The process of refactoring it out into its own library would almost certainly be beneficial in many ways -- and a great opportunity to improve the code itself and take another look at what it does and understand what the point of it is. By that point, it is no longer self plagiarism by any measure, imo. This is totally different from copypasting code all over the new project.
    – zxq9
    Nov 3, 2015 at 1:13
  • 7
    @DavidGrinberg Professional programmer chiming in: Re-writing your own code is a great exercise. You can always make it more elegant, more flexible, faster, better, even if you don't rewrite it in a new language or framework. Any talented programmer could rewrite his treasured libraries over and over again if not constrained by time and reason. In moderation, it's a great way to become a better programmer. Nov 3, 2015 at 11:30

Like qsp, I'm not of the opinion that this is self-plagarism.

Nor do I think it's an 'external library' by any meaningful sense of the word. For that matter, what are you expecting him to really do - he's already written code to do this, even if he wrote it again from scratch, is he not allowed to refer to other things he's done? I constantly look back at old code (I did this in a clever way sometime last year...). Where do you draw the line - are you allowed to look back at your old code if you can't remember something basic, but know you've done it before?

If you want to make the argument that you won't learn anything if it's already done and implemented, I could understand that. The problem is that you've dug in your heels on making this an ethical issue when that's at best questionable, and to be frank, if you used the language you've used about your partner with me, you'd likely poison our working relationship as well.

  • There is a very fine line between referencing your old work, and copying and pasting half of a previous project. People forget things over time, and if he already knows the material I don't think it's unreasonable at all to expect him to reimplement it. This isn't the private industry, this is a graduate program where everybody has to follow the same policies.
    – Byte Lab
    Nov 1, 2015 at 1:04
  • 47
    @110100101110101 Based on your commenting and voting, I'm not sure you're not just fishing for someone to agree with you.
    – Fomite
    Nov 1, 2015 at 1:06
  • 57
    I'm saying it's not clear it's cheating. If a student came to me and said "I've already written the code that does large parts of X, can I just use that?" the answer would be yes. You can't get the TAs to answer, and the Prof. hasn't weighed in. The only authority declaring it's cheating is you. You asked us, and several people said "We don't really think it's cheating." That is an answer...it's just not one you like.
    – Fomite
    Nov 1, 2015 at 1:08
  • 8
    @110100101110101 This question (which differs from what you actually asked imho) would be closed on this site, because it is theoretically. Your assumption that it is plagiarism is seen as invalid by almost everyone here, so in short I would say your assumption is incorrect. Every reasoning based on an incorrect assumption is purely theoretical and of no value and will also be incorrect, so what is the point in answering it? Even if you don't accept the predominant opinion here, please acknowledge it at least that we reject your assumption.
    – dirkk
    Nov 2, 2015 at 14:43
  • 2
    In University, I regularly re-use code from previous projects (either other class projects or code I've written at work and have permission to use from my employer). There is nothing to gain from re-writing exactly something you have already solved - and it's great practice for real-world development where this sort of thing is expected and commonplace.
    – SnakeDoc
    Nov 2, 2015 at 18:25

Your question raises interesting issues of honesty, teamwork and psychology. Let's examine how some of those ideas interact in your situation.

Now, the course instructors have made it clear that we are not allowed to use any external libraries to perform certain classes of algorithms for this project. This students' prior code would fall under this category of prohibited tools, but he claims that it doesn't qualify because he wrote the code himself (so it is not an "external library"). I believe this is hyperbole, but he staunchly disagrees.

Okay, so you and your partner disagree about something; this is not an infrequent occurrence during a collaboration. However, it seems to me that you are approaching this debate from a point of view that assumes that there is some objective truth here, and furthermore feel very strongly that that truth is on your side: your partner's old code logically seems to you to be an external library, and you are having a hard time believing that anyone could honestly think otherwise, unless he is motivated by laziness or self-interest. Well, actually I think that's far from the case; not only is it not obvious to me and to some of the other users here whether old code will count as "external library" or whether reusing it counts as self-plagiarism, but I think even the course professor might not be sure and have to think a bit when asked this question (and I say this as a professor who has some experience being asked unusual questions that I did not expect by my students in connection to my course policies). So, a first piece of advice I would give you is to tone down your rhetoric a bit. Yes, maybe reusing old code is a bad idea and will be seen as dishonest, especially if done without acknowledging it. You are quite reasonable in being concerned about this and worrying about your reputation. You should certainly check this, but before you start throwing around words like "hyperbole", it's a good idea to be a little bit more humble, make fewer assumptions and be more open to the possibility that other very reasonable people may disagree with you about this.

It has gotten to the point where the other student and I cannot see eye to eye on this issue, and I am worried that if he refuses to simply accept that we have to do all the work for this project [...]

I think you need to remember that your partner is a member of your team. You are not his boss and cannot demand that he do things exactly the way you want or accept your way of thinking. Furthermore, this project is not just an exercise in programming, it is also meant to teach you teamwork -- the art of working as a team, which is something that's highly valued by employers, in some cases much more than specific programming or machine learning wizardry. When you talk about him "refusing to simply accept that we have to [do things my way]", and say that you have reached a point where you and your partner are close to being completely unable to work with each other, I see this as a failure to establish effective teamwork. Disagreements will come up in any collaborative project; you are now being tested on your ability to work through them effectively, by talking to your team member, and also by listening to him and being open to hearing and accepting his point of view.

Nobody has answered my question, they've only said, "it's not cheating". [...] that doesn't answer the question of how to handle it if it is cheating. That was my question. Assume it's plagiarism. How do you protect yourself?

Well, if all you want is an answer to your literal question and don't care to hear any additional analysis: if I had a project partner who was a cheater and I couldn't convince him not to cheat, I would not partner with him. I would go to my professor and ask to be partnered with someone else, or to be given a solo project if that's the only practical option, and explain that working with the current partner is ethically untenable for me.

However, if you are willing to consider additional analysis, I will venture to offer my opinion that you are asking the wrong question. Based on my understanding of your situation, I think you are too sure that you are in the right and your partner is in the wrong, and in this case, refusing to partner with him will reflect poorly on you, since it will indicate that you do not have good teamwork skills, which is part of what this project is meant to test and help you develop.

To summarize, the core of your question is actually about a simple matter of how to interpret a course policy that forbids the use of external libraries in a programming project. When professors write their course policies they don't always think of all possible scenarios that could arise, so it is not uncommon for ambiguities to exist. When this happens, the best thing to do is simply to ask the professor (but please ask politely and in a neutral way that does not assume what the correct answer is), then follow their instructions. If you do this, I don't see how your reputation can be hurt.


I'm afraid you are understanding "self-plagiarism" incorrectly. The purpose of coursework project is to help students understand the algorithms. That's why the professor does not allow the use of external libraries. However, in your case, your partner did implement the task by himself (if his partner in undergraduate did that, it is a different story). So he does not cheat here.

Actually, for this project it is better for you to take the responsibility of doing the task that your partner have done. Because he already fully understood the task, and you don't.

  • 2
    @110100101110101 Is he reusing his code without any modification, or is he simply choosing not to rewrite the wheel? Because I've been to many classes that absolutely do assume you'll build off things you learned before.
    – Fomite
    Nov 1, 2015 at 0:55
  • 1
    @Fomite, okay I'll rephrase, should a student be allowed to copy and paste half of an essay and hand it in as though it's an original piece of work?
    – Byte Lab
    Nov 1, 2015 at 0:57
  • 17
    Talking about 'an essay' is entirely misleading. Re-using code you happen to have written before which proves useful for a new project is certainly different; whether that is acceptable or not depends on class guidelines (but my guess is that yes). Just saying. Nov 1, 2015 at 1:05
  • 3
    @110100101110101, I would say that the purpose of a class is that the students learn the material. If the student in this case used this algorithm in a previous class then they obviously have learnt the material. The only important question for an assignment should be "Is this project solely the work of the students?". In this case, the answer is "yes". Nov 2, 2015 at 1:19
  • 21
    @110100101110101 If you're forbidden to reuse previous work in a computer science course, that's just one more way in which academia is completely out of touch with reality. Students should be required to reuse previous work. How to reuse code effectively should be a major part of the curriculum. Nov 2, 2015 at 2:35

Regarding the rules made by the professor, the letter of the law is clear insofar that it absolutely allows both your interpretation and that of your colleague. So disregard it and look for intent.

In terms of intent, what we can do is make an educated guess, but a much easier way to find out about intent is to simply ask the one who made the rule.


In formal academic writing, the problem of self-plagiarism is answered by citing the sources that were used, even if the sources are by the same author. I think it would not be unethical to reuse the code earlier written by your groupmate as long as your groupmate explicitly states to your professor that the code was written by the groupmate for an earlier course. Ask your professor if this arrangement is acceptable and does not violate school policy.


I don't see what the problem is. If you have written code before to neatly display certain data, or ask for input from the user, it is silly to not re-use this code. Just make sure to add a comment above the functions or code blocks that have been re-used and briefly list that you are the author, and where you have used it before.

If the course itself is for learning about algorithms, it is unwise to re-use any code that had to do with algorithms. First of all, it is likely not tailored to the problem at hand. Second of all, you do not learn much with copy-pasting. If you have completed the course before, the professor would likely have given you permission to skip the practical assignment. If the professor did not do this, it is likely they want you to redo at least that part.

That said, re-using (part of) the code for tree-building and tree-traversal when you need to implement a search algorithm is fine as far as I am concerned. Trees are not that difficult to implement, but it is boring to have to write that code again and might introduce bugs you already have solved before. You are likely studying computer science and aren't trying to get a degree in Typist Science. Solving problems you have already solved before is not productive. Spend that energy on understanding and implementing the new stuff. If you have done a lot of the project before, just spend time on polishing the project, or ask for a more challenging project. Again, just make sure that there can not be a misunderstanding about where code comes from by puting a comment with author, source location and possible license above the code that has been re-used.

Thas said, I think you should learn two things from this:

  • Make sure that you and your partner are on the same page at the beginning of the project. It sounds like you might have put off working on the project until it was too late to back out.
  • If there are unbridgeable differences between you and your partner, you still have an obligation to finish the project before the deadline. Don't sit around argueing with each other, but work on the project on your own and encourage the partner to do the same. If the differences are not bridgeable in the future, you might need to hand in the project alone. Make sure you make clear which part you did with your former partner, and which part you did alone.

I'll go for a more succinct answer.

Is the above situation usually considered to be self plagiarism? Why or why not?

No, because: 1. It's not a publication, nobody can plagiarize anything. 2. You're not pretending to have come up with original research results in this assignment.

Is the above act typically allowed in an academic setting?

Yes in my experience (as a student and TA). Really, we don't care about this kind of stuff. Projects and homework are a courtesy to you students, to help you reach a better understanding of the material; and grades are just a rough statistical mechanism.

Assuming you are in my position... what is the best way to proceed... ?

You should "cheat" in this situation. Even if it "doesn't feel right" to you - objectively it's not cheating, and it is acceptable to about everyone else concerned.

  • To the nay-sayers: Well, somebody has to tell him that :-)
    – einpoklum
    Nov 4, 2015 at 23:18
  • 3
    Everybody's answers are great, but long. And I see you decided to take the opposite approach on both counts.
    – Dan Romik
    Nov 4, 2015 at 23:48
  • 2
    You should "cheat". Even if it "doesn't feel right". Regardless of what "about everyone else concerned" thinks (I'm impressed that you're a mind reader and can read everyone else's thoughts), that is terrible advice.
    – Byte Lab
    Nov 5, 2015 at 0:51
  • well i up-arrowed this. still left at -2. Nov 5, 2015 at 1:06
  • @DanRomik: Rephrased that sentence to make it less, shall we say, dismissive. More constructive criticism would be appreciated though.
    – einpoklum
    Nov 5, 2015 at 10:03

Imagine the problem this way: Each class you take, is like you being a contractor for that class, writing code for the "company" that is running that class. So, when you finish the semester, and move on to the next gig (i.e. the new semester starts and you're now in this project), the problem you have here is that, in principle, your partner does not own that code. It's not strictly true, but it's essentially the same type of issue!

You can bring concepts from place to place, but you can't carry CODE from place to place, and that's the same in academia (apparently so in this circumstance, anyway!). The definitive answer is that you and your partner have to take what is called a "green-field" approach to the code he wants to carry forward...you have to re-write it anew.

Also, the so-called problem of self-plagiarizing is very real and a very common problem. You can't just pick up academic work done for one class and re-submit it for another class...if you're caught, it's usually a big problem. You can get by it by going FULL DISCLOSURE, and full citation (to yourself as the previous author) but that's something that requires direct and prescribed intervention BEFORE you hand it in, with the professor involved. Some will be ok with it, some decidedly not. It's their call.

My suggestion? You propose along with your partner that you re-implement his existing API with new code. You bring the code to the instructor, say that it is what you intend, and get her prior blessing.

  • 8
    I kindof disagree here. There are several reasons to take a course, to learn and to certificate (get credits). Sometimes you simply have students who know the material but are for reasons beyond them needing the credits. It is perfectly fine for them to leverage on previous knowlege. In a perfect world they would just be given the credit for the work they have done. Unfortunately that seldom happens so they must do this. Also even if the student would rewrite the code he can really never escape having done it before.
    – joojaa
    Nov 2, 2015 at 8:01
  • 2
    I'm currently in the process of rewriting some VERY SOLID code I wrote previously. It's amazing how "awful" that previous code is, after a bit of time and some fresh perspective! Suffice to say, yes, there are only so many algorithms, and only so many ways to skin a cat. If you've written something before, and now you have to do it again, it's going to come out similarly. No question about it. But also suffice to say, there are very valid reasons to have to rewrite!
    – dwoz
    Nov 2, 2015 at 21:05
  • I dont claim that repetition dont make better. Its just that it is somewhat wrong to ask a person to redo work when others arent redoing it. People can have other priorities. They are there to learn up to certain standard. Beyond that its the students own initiative. The scool can not demand this, your not evaluating the student by their full potential just the relative level compared to others and some goal level.
    – joojaa
    Nov 4, 2015 at 21:19
  • 1
    This answer is based on a false premise. Depending on what contracts are in place, you very well may be able to take your code from place to place.
    – RubberDuck
    Nov 5, 2015 at 4:08
  • @RubberDuck, after many years of working in the software industry, I have found it to be the case exactly zero times, that code I've written for my employer is freely available to me after I've left. Except, of course, code that was released as GPL code to the public. Regardless, it's not germane to the question, which is, "what is the professor's desire here?"
    – dwoz
    Nov 6, 2015 at 21:49

You must log in to answer this question.

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