68

I am a PhD student and I wrote a computer program for my dissertation research. Recently my advisor professor got a grant and she wants to use my computer program in her grant and she asks me for the computer source-code. I will graduate next May and I am planning to use this program in my other studies. So I am not willing to share the code with her. She didn't mention future cooperation and I will also not cooperate with her because of huge differences in our research interests and perspectives.

So how can I refuse her properly?

Note: I was not a RA for her when I wrote the computer program, but this semester she got a grant and she set me as RA.

30
  • 102
    Does sharing your code with her prevent you from using it in your other studies? I don't understand why sharing your code is a problem here. Research projects in CS and Computer Engineering frequently use other groups' code without infringing on one another's research.
    – tonysdg
    Commented Oct 31, 2016 at 4:08
  • 110
    This is great that someone wants to use your software! You might even get some cites from this, congratulations! You could even put it on github or something so that she can cite that too and others can benefit from your program. Commented Oct 31, 2016 at 4:15
  • 81
    I understand that you're upset with your advisor for whatever reason. But, you may stand to lose a lot by refusing to share your code (alienating your advisor, not getting good recommendation letters from her when you graduate, etc). On the other hand, I can't think of a single thing you will gain by refusing to share.
    – ff524
    Commented Oct 31, 2016 at 4:46
  • 66
    If you wrote the program for your dissertation research, doesn't it belong to your institution?
    – Phil
    Commented Oct 31, 2016 at 9:34
  • 13
    @W_H Generally speaking, you don't cite computer code, you cite the papers which first introduced or described the computer code. A paper cited for the methods section looks exactly the same on your CV or h-index (and to the tenure committee) as a paper that's cited for the conclusions section.
    – R.M.
    Commented Oct 31, 2016 at 15:20

11 Answers 11

237

One of the reasons Science has been so successful is that scientists treat knowledge and tools as public goods. We don't hoard knowledge, but rather we write papers, share techniques, offer suggestions, etc. There are certainly cases in which sharing isn't beneficial, but these seem not to apply here. So of course you should share your computer program! You should share it with people you like, people you don't like, and people you don't even know.

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – ff524
    Commented Nov 6, 2016 at 0:09
85

Ideally in this situation you would make your program publicly available.

Giving others access to this code does not prevent you from using it, and will help you build reputation within your field.

Not only that, but by making it publicly available rather than to just your advisor there is no risk of them claiming your work as their own - which I would assume to be your primary concern with the current power balance of your relationship.

4
  • 4
    If you publish it online with a free software license (e.g. GNU GPL, Apache Software License etc., see this page for a list and comments) - it will be unlikely it could be misused to appropriated by your Professor.
    – einpoklum
    Commented Nov 1, 2016 at 21:37
  • 5
    @einpoklum: there's a big difference between a copyleft license (like the GPL) that requires that copies stay open-source, vs. the MIT or BSD licenses that let people use the code as part of a closed-source project. Choose whichever you want based on how you want people to be allowed to use your code. Commented Nov 2, 2016 at 3:50
  • 1
    @PeterCordes: You're right, but - the code would still not be usable as something a third party can submit as their own work to some grant committee or other financing body.
    – einpoklum
    Commented Nov 2, 2016 at 8:20
  • 3
    @einpoklum: Ah yes, that kind of misuse. I think even if you made your code public domain, it would still be plagiarism for someone else to claim credit for it. ("Look at this play I wrote, it's called MacBeth"). The difference is that you can take legal action directly, because they'd also be violating your copyright rights as well as committing plagiarism / fraud (against the grant committee, not against you). Commented Nov 2, 2016 at 8:29
75

As someone who works in scientific computing, I agree with what others say, and would likely take it a step further. To put it hyperbolicly:

Refusing reasonable requests to code used in a published article is ethical misconduct.

If you relied on the output of a program to produce your scientific result, then that program is part of the "materials" of your paper, and the same guidelines for sharing other materials used in making papers apply. Just like you're ethically obligated to reasonably make available (non-commercially available) plasmids, cell lines, mouse strains, etc. which you generated for your published research, you're likewise obligated to make available the (non-commercially available) code that you generated for your published research.

That's even more applicable to code, as code is not just a "material", but also a "method". While you certainly should describe the algorithm in text, there's typically a large number of details which are only apparent on examining the code. It's unlikely that a researcher would be adequately able to recapitulate your results from a reimplementation of the algorithm from just the methods section. This is particularly true in the (unlikely?) event you have a bug. Not releasing code is equivalent to just saying "We purified the protein" or "We measured the X" in the methods section: lacking in the needed details for someone to adequately reproduce your results.

Of course, "reasonably" is there in the release requirements, but "reasonable" refusals for wet-lab materials tend toward availability and time considerations: there's not currently enough of it to share or it would be a significant burden on the lab to send it to you. These tend not to apply for software - you can make as many copies as you want, and it's cheap to do so.

"Reasonable" refusals of software tend toward licensing issues. For example, if you don't have the legal ability to distribute the code due to the libraries you used. Or if your institution is selling the code commercially, you may need to require others to obtain the software commercially.

In your case, it doesn't sound like you have an effort-based or license-based reason for refusal. It doesn't even sound like you're refusing due to potential competition ("huge difference in our research interests and perspectives"). Instead, it sounds like you're more refusing because you are nursing a grudge. That's not good. It certainly happens that others act that way, but I think most people would agree that refusing reasonable requests for methods and materials sharing because of pique is unethical.

12
  • 4
    I hope they will now give me codes to the UK Met Office weather model, because someone certainly published something with it. If it is an academic misconduct... Commented Oct 31, 2016 at 18:53
  • And that many papers about simulations with ANSYS/Fluent.. Commented Oct 31, 2016 at 18:54
  • 11
    He does not need to release MATLAB because MATLAB is already available to all scientists (and others). (same for other tools) Commented Nov 1, 2016 at 1:07
  • 8
    @DavidW Just because it's materials, doesn't mean you own all rights to it. For example, if you did a research study on Viagra, then Viagra would be a material for your paper. That doesn't mean you can claim ownership of Viagra. The bulk of the answer only pertains to code you generated yourself. As David Balažic mentions, if code (or other materials) were obtained through third parties, you can direct people requesting to go to those same third parties.
    – R.M.
    Commented Nov 1, 2016 at 18:09
  • 12
    “to put it hyperbolicly” — No. This is not a hyperbole. It’s literal truth. And luckily it’s increasingly handled just like this by institutions (though progress has been slow). Commented Nov 2, 2016 at 13:52
72

If you wrote the code as part of your work as a PhD candidate, and were at all considered an employee of the institution as a PhD candidate, then the institution may well own intellectual property rights to the code you write ("work for hire" rules). This of course depends on the laws of the country where your institution resides.

If you wrote code that is essential for some future work of your supervisor, and which reflects an important intellectual contribution, then either (a) it should be cited if a publication describing the code exists; or (b) you should be an author on publications using the code.

In any case you have a moral (and possibly legal) responsibility to share the code; your supervisor has a reciprocal responsibility to acknowledge your contribution properly. Ideally you should publish your method (e.g. Frontiers Neuroinformatics), and then it can be cited in academic work.

7
  • 9
    Very often a PhD candidate is a student, not an employee. Commented Oct 31, 2016 at 11:29
  • 7
    Often, but not always. Commented Oct 31, 2016 at 12:06
  • 3
    Writing code is sometimes, but not always, an intellectual contribution that merits authorship. (Whether or not it is "essential" to the work does not necessarily determine whether authorship credit is appropriate.)
    – ff524
    Commented Oct 31, 2016 at 14:34
  • 11
    @VladimirF Such rules on intellectual property may apply to students, too.
    – Greg
    Commented Nov 1, 2016 at 13:39
  • @ff524: You're right. There's a big difference between writing a plotting function, and developing an analysis toolchain. I edited my answer slightly. Commented Nov 1, 2016 at 15:57
36

A lot of people have mentioned making your code available, and I entirely second that. But to get more specific, put it on GitHub.

Public repositories are free, it keeps a version history of your work so that even you can't mess it up in a terminal way, and others can branch your code off in another direction and develop it, all while keeping the proper reference back to you as the originator. You can include your licensing in the repository; you often want one that allows free usage but requires citation. GitHub even automates it for you.

You can also explain your code and leave links to your website/published work/etc using markdown in the readme.md file

Then when someone like your professor asks for your code, you just share your GitHub link.

12
  • 7
    Yes, this. Open source software has been dealing with this issue for years and many standard agreements allow you to simply license software.
    – user64190
    Commented Nov 2, 2016 at 12:53
  • This is good advice and GitHub certainly is great but what part of this answers the question? Commented Nov 2, 2016 at 16:57
  • 1
    @RyanfaeScotland I think that's an unnecessarily pedantic adherence to a literal reading of the question, which isn't the way StackExchanges work. The question was "how to not share it" and the correct answer is "actually you should share it and here's why", while my answer simply adds "and also, here's how you can share it in a way that should address any concerns with sharing it."
    – Jeff
    Commented Nov 2, 2016 at 17:12
  • 1
    @JeffL I don't assume the OP knows the best solution and it could be the solution they need help with is going to make the situation worse, I'd advise on it but still answer the question. Take this Q as an example, if I had the rep my answer would be 'If you are commited to refusing then you can do so politely as follows.... however be aware the code may belong to the university as part of the conditions also be aware you may be burning your bridges and limiting the good that can come from sharing your work.' Alas I don't have the rep (perhaps cause of my too literal answers!) Commented Nov 3, 2016 at 8:27
  • 1
    @jpaugh: I'm pretty sure Github doesn't have a "default license". Quoting: "[The] absence of a license means that the default copyright laws apply. This means that you retain all rights to your source code and that nobody else may reproduce, distribute, or create derivative works from your work." (Github does reserve some rights though, through the ToS.)
    – You
    Commented Nov 6, 2016 at 13:07
20

It's generally considered good practice to publish code that you use for research/analysis related to things you publish. Not everyone does but then lots of people fail to follow best practices.

Not publishing it is like keeping part of your methods secret or using confidential chemistries.

If you've used it for other publications then not only should you provide it to her: you should provide it to everyone who might want to inspect/replicate your work.

Also, as someone working in a neurology dept who writes a lot of code: Yes citations for analysis does still count positively, not as much as citations for things in your exact specialty but it shows you as being more well rounded.

15

Code used in research should be peer reviewed just like any other methods anyway.

First things first: find out who is the owner! I'm not a lawyer. Depending on situation, country etc, code may already belong to institution, research group etc. Before refusing, first make sure it's really your decision to make.

If it's yours, I suggest making it public, but put licence that will require mentioning use of it when results are used, and require sharing improvements with you.

5
  • In practice (and unfortunately), the costs of reviewing (potentially large amounts) code to the required level are prohibitive, and it's also not clear that the same people who are reviewing the paper should be reviewing the code (put bluntly, not all good researchers are good programmers). Moreover, a lot of research code is (quite frankly) hacked together just before the deadline to the point that reviewing it would be (a) an unholy nightmare and (b) unproductive. Commented Nov 1, 2016 at 19:41
  • 2
    I say this as someone who's spent a lot of time over the past couple of years reviewing code in a research context - you can do it, but it takes ages, and you have to be willing to let people incur (significant) technical debt just before deadlines and (hopefully) pay it back afterwards. It's not ideal, but the way in which academia is structured (i.e. prioritising papers over code quality) makes it difficult to do much more. Commented Nov 1, 2016 at 19:44
  • @StuartGolodetz even if code can't be reviewed, it should at least be reviewable, right? If anyone would doubt if program results are good, he should be able to see for himself?
    – Mołot
    Commented Nov 3, 2016 at 22:14
  • 1
    Yes, in principle. In practice, though, stipulating that all source code must be released as a condition of publishing (which is the obvious way to try to enforce it) would just restrict who could publish papers - in particular, licensing and intellectual property issues can prevent people from releasing their source code even when they want to. I would err on the side of rewarding people who publish their source code rather than punishing those who don't. (Disclaimer: I publish my source code and I want cake, so I'm not unbiased.) Commented Nov 4, 2016 at 0:14
  • "Code used in research should be peer reviewed just like any other methods anyway." - I am not convinced it is useful in any way to spend scientific peer-reviewing resources on evaluating makefiles that copy our documents to our internal share server. Commented Nov 6, 2016 at 12:46
12

Read your institution's policies.

Your position assumes that you own the copyright for said code, and that's false in general. This will strongly depend on which university you attend, your formal student/staff status, and the institutions that fund you, but there are plenty of cases where the copyright for a PhD candidate's research output rests with the university. Moreover, in those cases, the person responsible for this bit of intellectual property is usually your line manager - i.e. your supervisor.

That means that your supervisor may well have the legal right to demand that you give her the code, and that you refrain from using it in further research outside of your current institution. This means that your very first stop here needs to be verifying that this is not actually the case.

4

If you must refuse, refuse in person, or refuse by phone. Do not put anything in writing, unless you're absolutely sure of your rights.

Since your advisor is making you a Research Assistant, note that she could be implicitly buying your future collaboration as well. After all, if your code is sufficiently complex, she may require your expertise to install it, understand it, run it properly, and possibly modify it.

In which case, you could use the fact that you don't have the time to work with her, nor the time to clean up your code to make it more readable or usable right now. Or you could simply refuse her request without justifying yourself to her (but again, do not put any of this in writing, just tell her in person or over the phone, if you're not absolutely sure of your rights).

And some people mentioned that you might want to get cited for your source code, but it could also be that you don't want your name associated with her project. So you could ask for that as well if you wanted.

Or perhaps, you could set the goal to release the source code, but only a year or two from now, by which time, it will be too late for her to use it in her grant. Or perhaps, you could release an older less usable version of the code.

Or if your relationship ended really badly, you could just tell her that you won't help and that you don't wish her to ever contact you again. And then, you could make a filter that ensures that you never see her email messages ever again.

My point is that you have many options. It's just that I am not really clear about your reason for refusing her request. If we knew your exact reason, then maybe we could supply you with a more exact answer.

4

Here's what I would advise: write a paper that uses and explains the code. Then when you share the code, request that whoever you share it with cites your paper.

A good example is here: http://www.modelinginfectiousdiseases.org/. Read the last line, where some code is distributed with the line "if you use any of the programs in your research, we ask that you reference..."

Especially in your case where you say you have different research interests, and so your advisor will not be competing with you, you're just throwing away free citations (and good letters of recommendation) if you refuse to share. The fact that no-one has given a good answer to "how to refuse" is because we can't think of any good justification for doing it. If you really need an answer to this question, you need to explain what the reason is to do it. "I don't want to collaborate" is not a good reason.

1
  • 1
    I am not convinced a paper about a set of utility routines that combines spreadsheets from different Excel files into a single Excel file will be accepted anywhere. It is simply not interesting as research. No, the OP doesn't say that's what their code does, but they also do not say anything beyond "a computer program for my dissertation research", so it is completely possible their computer program is meant for such "menial" tasks. This answer applies only to the limited case that the computer program is the actual subject of the research. Commented Nov 6, 2016 at 12:49
4

One of my friends has been in a similar situation. He was not willing to give his LaTeX notes to our boss, because a former postdoc in the group did that before and our boss (according to them) published stuff in the notes without giving this former postdoc co-authorship. As a result, the relationship between my friend and my boss at the time soured and my friend lost a few job opportunities because of bad recommendation letters.

I, on the other hand, always share codes. The codes are not meant for advisers who rarely have the time to dive into them. They are meant for future graduate students who have the time to learn from them and, sometimes, happen to find bugs we never thought of.

There might be some rules, as other posters said, on sharing intellectual property generated while working at the university, and your adviser might try to enforce them, depending on your relationship with them. Instead of refusing, I would rather ask for being cited properly, and if there is any extra-work needed to help her with running the code you should tell her you want co-authorship of the papers.

1
  • 3
    This is why publishing the code online on github is ideal. As would be publishing the notes on ARXIV in your advisors case. If they are already published, the advisor will have difficulty plagiarising it. Commented Nov 1, 2016 at 16:21

You must log in to answer this question.

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