My advisor has multiple electrical engineering masters research students under him. One of them came to me asking for help, saying the advisor asked her (let's call her Jen) to write some code to test out one of his ideas and generate graphs for a paper. Jen is horrible at writing code (her words), so thinking this was a rush job and not related to Jen's research (her words again), I ended up writing all the code. I spent way more time on it than I originally expected to, but it's done, the advisor is happy, and the paper is submitted with everyone's names on it. FYI, this research is completely unrelated to mine.

Turns out, according to the advisor, this is Jen's research topic. The advisor has now asked that I send the code to both of them so they can make some modifications and continue the research. I estimate the modifications to be 10% of the work that I've already contributed. While this isn't Jen's entire thesis, I feel I have completed a massive part of it for her and don't want to just give it all away, just to have to go and then do my entire thesis as well.

Is it normal for code to just be shared (likely without citation) internal to a university? Should I just send the code? Should I question the request? Should I flat out refuse to share it and make Jen develop the code on her own (given there isn't an immediate paper deadline pending)? I don't want to offend my advisor, but I don't know the standard procedure for academia and want to make sure I'm not being taken advantage of here.

  • 18
    What do you stand to gain from not sharing the code?
    – ff524
    Commented Nov 25, 2015 at 5:41
  • 3
    ff524 is correct, in that if sharing the code won't disadvantage you in any way then it's probably sensible just to share it. Scientific progress is much faster when we all cooperate.
    – Moriarty
    Commented Nov 25, 2015 at 11:02
  • 6
    Okay then. What do you stand to lose by sharing the code?
    – JeffE
    Commented Nov 25, 2015 at 18:22
  • 1
    1) A good code is used for multiple piublications. 2) If you do not know how to do them out of your code, then give it to humanity. 3) We routinely share codes not only within the group, but also within collaborators. I do not know how one can make a trustful team otherwise. Commented Nov 25, 2015 at 20:44
  • 1
    I sympathise with your feelings, nevertheless notice that, especially in Academia, there is no such thing as your work, that belongs to you. Whatever everybody has done anyway comes from someone else's pillars, knowledge and lectures. We surely give contributions investing our time and lot of efforts, but I don't believe this justify the possession of the outcomes. It is different in the private sector, where outcomes have to be sold to customers (then you may want to copyright and protect them).
    – gented
    Commented Nov 26, 2015 at 9:30

5 Answers 5


Should I flat out refuse to share it and make Jen develop the code on her own (given there isn't an immediate paper deadline pending)?

What would be the purpose of this? You'll upset Jen and your advisor, she'll have to spend time redoing what you've already done, and you'll have substantially decreased the usefulness of your contribution with no corresponding gain to anyone. The only reason I see is a feeling that Jen is getting away with something and not putting in enough work herself, but I don't think you should be concerned with this. Your advisor is aware of the situation and should ensure that she does enough work to justify awarding her degree. Maybe she is doing great things you are unaware of. It's also possible that she won't end up doing as much as the average student, but that's OK: she'll still deserve the degree, but just won't get strong letters/references. By contrast, you'll get glowing reports of how you not only completed a substantial project of your own, but also stepped in to make major contributions to an unrelated project and ensure that it met a deadline. That will put you in a great position.

Should I question the request?

I don't see a purpose to questioning it unless you might plausibly refuse to share the code.

One option is that you could propose continuing to collaborate on this topic. However, you'll have to handle it tactfully. For example, it would be awkward to try to use the code as leverage to force a collaboration (by saying "I'd rather not give you the code, but I'm happy to make further changes if you let me know what you need"), or if it comes across like you are cutting Jen out of the project by offering to play her role and suggesting you would do a better job of it. If you'd like to collaborate, it's reasonable to say so, but you should be open and collaborative, and make sure to allow everyone an opportunity to contribute. (And it's best not to let this distract you too much from your primary project, since you'll have more to gain from a project you have greater ownership over.)

  • 4
    I don't really see why proposing a continued collaboration would be awkward. I don't think saying "I'd like to continue being involved" will be seen as trying to take over the project.
    – ff524
    Commented Nov 25, 2015 at 18:09
  • @ff524: Thanks, I edited to give examples of what I think would or wouldn't be problematic. Commented Nov 25, 2015 at 19:00

If I understand you correctly, you were asked to help write code from a colleague, you wrote it, then were a co-author on a paper related to your contribution with this code. Now, your co-authors want the code, and will continue to work with it?

If this is the case, I dont think they can truly publish another paper without more than 10% of the modifications, unless this code has less to do with the research than you think.

You clearly feel attached to the code, but as other questions on this site have found out, developing code does not mean you will be a co-author on all papers that use the code in the future.

You could put the code online as open source software, since you wrote it. They would then cite that link in their paper. Otherwise they will most likely cite the paper you all published together.

If you feel strongly, you could politely discuss this with your advisor, saying something like:

When Jen asked me about writing this code, I did not realize how much work it would be. After extensive amount of investement, I have become significantly invested in the code. Would it be possible to remain an active participant in this research by contuining to develop the code?

Again, this depends largely on the real situation. Code itself is most likely not the research, but instead implementation or a tool for the research. In that case, it really would not be Jens focus. Your advisor may agree to keeping you on. On the other hand, your advisor may just say you already have published a paper together, and the code you developed was for the lab.

Be careful of getting too connected to your code early in your masters. This will happen many times, and already having a publication out of your code is in a much better position than many.

  • 3
    If this is the case, I dont think they can truly publish another paper without more than 10% of the modifications, unless this code has less to do with the research than you think. What, why? Surely a sophisticated model can be used to study many distinct and relevant questions without any code modification.
    – gerrit
    Commented Nov 25, 2015 at 11:23
  • 2
    @gerrit Agreed "Code itself is most likely not the research, but instead implementation or a tool for the research" . If the model can be used to study those questions, it is not the code that is the research, it is those questions. Commented Nov 25, 2015 at 11:44

I think @AnonymousMathematician has already given a great answer explaining why there is no real benefit for anyone -- including you -- to not sharing your code. I have nothing to add to this, but a simple observation: You may have some moral reasons for not sharing the code unless you will also be a co-author in the future, but you have no no legal argument that supports you in this. At least in the United States, as a graduate student, you do not hold the copyright in the code you write. Your university as your employer does. So at least legally, your professor has every right to require you to pass along the code.

  • 1
    "At least in the United States, as a graduate student, you do not hold the copyright in the code you write. Your university as your employer does." - As a universal statement, this is not true. Here is a counterexample. In general, many universities do not assert ownership of "scholarly work" (which at some universities includes software that isn't a patentable invention.) (And we don't even know if the OP is an employee of the university, or if he/she is just working on an unpaid masters thesis.)
    – ff524
    Commented Nov 26, 2015 at 2:11
  • @ff524: We could have a much longer discussion about this than this forum allows. The fact that UW does not "claim ownership rights" is now a legal term I understand. Someone has the copyright in code, whether claimed or not. Who that is is covered by law. My only interpretation is that maybe they don't assert that right. The remainder of the statement clearly states that there is no blanket policy that everything that is copyrighted is put into the public domain. In either case, as a graduate student, it is likely a useful assumption that you don't "own" your code. Commented Nov 28, 2015 at 19:22

If "Jen" is "is horrible at writing code," how the heck is she going to modify your code without butchering it? Let's imagine that you play along and hand over your baby. The following possible outcomes spring to mind:

  • Jen manages to break the code, and she comes running to you each time she breaks it.

  • Not understanding the code, Jen draws invalid inferences.

If you and Jen were collaborators on a project together, and there were no PhD theses hanging on it, things would be different. It is very common that on a collaborative project, one member of the collaborative team is stronger on coding and is the one who writes, modifies and explains the code to the other member(s) of the team. In a project of that type, the code specialist can put some code modification ground rules in place, such as a version control system.

I would have reservations too in your shoes. It's time for a one-one-one conversation with your advisor.


I would say share the code but make it clear to both the student and the advisor that you expect to get credit for it.

It might be an idea to clarify the copyright status of the code too. This can depend on both local policies of the university and whether or not you were acting as an employee when you wrote the code.

If Jen tries to claim the code as entirely her own work that is serious academic malpractice.

You must log in to answer this question.

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