I am an undergraduate working as a research assistant for a university, primarily alongside a supervisor. While I have my own project, my job still has me assisting my supervisor in his main research.

Recently, my supervisor assigned me a small coding project that would expedite data analysis for experiments, benefiting both of us. I would gladly write code that simplifies his work and mine as is my job as his assistant. However, I am anxious that the code I have written will be dispersed and used throughout the research group. This sentiment is due to the fact that this coding project arose during group conversation including myself, my supervisor and another researcher, who pointed out such a program would save himself and others in the department time and energy.

My Two Questions

Am I justified in feeling like I'm being exploited by the other researcher to write this code or am I being selfish?

Can I protect my code from others using it without creating tension/enemies?

I believe my energy and time are first and foremost reserved for my supervisor's work and my own. This is code that is relatively easy to write but is rather time intensive. I see that if the other researcher wants to have this shortcut in data analysis, he could write it himself. It wouldn't bother me as much if the project came directly from my supervisor as it would be explicitly for us. Afterward if it were shared, I don't think I would be as conflicted. Rather, the researcher who pushed the project is far removed from my work.

Otherwise, if this code does spread to other researchers, how would I ensure I receive recognition for it? I am pursuing further education with this department and want to better my reputation to admissions as a meaningful member of the research group. Perhaps I am being too petty or selfish with the impact of this code. This is the first time I've experienced writing code for something beyond classwork and I would like to approach the situation the right way.


Thanks all for showing me I was being really, truly idiotic. Most of these comments make sense or doled out the slap up the head I needed. Being able to better other industries is a huge point of my interest in the field so seeing it from the outside made it obvious I was being a hypocrite. I realize I need to change my mindset if research is something I want to pursue in the future. In the meantime, I'll diversify the code as much as possible to help as many as I can. Thanks all for the input.

  • Could you code it so it only works on your data and your supervisors? Especially if you provide it in a compiled version...
    – Solar Mike
    Aug 6, 2019 at 8:33
  • 41
    "I am anxious that the code I have written will be dispersed and used throughout the research group" - what would be the downside of this happening?
    – user107417
    Aug 6, 2019 at 14:09
  • 10
    AcademiaSE (academia.stackexchange.com) would have been a better fit for this question.
    – Erwan
    Aug 6, 2019 at 19:24
  • On your edit: don't beat yourself up! While your initial mindset was off target, it was better that you asked than to continue down the path you were on.
    – zr00
    Aug 8, 2019 at 15:50

6 Answers 6


Am I justified in feeling like I'm being exploited by the other researcher to write this code or am I being selfish?

No, you aren't being "exploited" - if I understand you correctly this code would benefit you and your supervisor as well. That it will also benefit others is good thing.

Can I protect my code from others using it without creating tension/enemies?

You can possibly protect it, although this is unlikely given you are working for the university and they likely "own" the work anyway. But I think even the attempt to do so will likely cause "tension/enemies" as you put it.

Why? Because you have literally nothing to gain from keeping this code from others at the research group - all that does is hurt others which is going to make it look as though that was your intent. And that's pretty likely to annoy people.

I am pursuing further education with this department and want to better my reputation to admissions as a meaningful member of the research group.

This is where you've got things backwards - if you create something meaningful in the context of the research group you want others to benefit from it. The more members who benefit from it the greater the impact. The more people you try and keep it from the more people you are going to have telling people (such as those involved in admissions) that you're a selfish kid who isn't a team player.

  • 40
    Further, if the code is really that useful, consider making it widely public. Then you risk being known for it, which won't hurt you a bit on interviews, both on industry or academia... Aug 6, 2019 at 13:47
  • 11
    @FábioDias while I don't disagree that it could be a nice advert for the OP's skills I'd be surprised if there weren't restrictions on whether the OP can actually do that with code developed during employment.
    – motosubatsu
    Aug 6, 2019 at 14:03
  • 4
    In industry, yes, in academia not so much. Either way, it needs to be approved by the supervisor/advisor... Aug 6, 2019 at 14:19
  • 6
    @FábioDias yes with supervisor/advisor behind the idea it's a whole different story!
    – motosubatsu
    Aug 6, 2019 at 14:36
  • 2
    @JanDoggen better off, make it actually useful. If you have a git or whatever instance and the code is there, include link to it so others can contribute to it. If not, include your email address with a note like "Contact in case of bugs or feature requests". Similarly, if there's a license associated with the program, include it there.
    – ave
    Aug 7, 2019 at 13:54

As this is the first time you are "writing code for something beyond classwork" I think it is important to learn some of the basic principles of what it means to write software for money, as I think once you understand these, the answer to your questions flow pretty naturally.

First principle: when someone pays you to write code, it implies two things: first, that you are writing something to solve a problem or fill a need that they have; second, that they own it and can do what they like with it. This principle is known legally as Work-For-Hire in the United States.

Second principle: the code you wrote isn't special - there are literally millions of other people out there which could have produced the same, or better, code to solve that same problem.

If you take these together, you'll realize that, first, it isn't your code (it belongs to your supervisor, or the lab, or the university, or whomever), and that the code isn't particularly valuable (all it is worth is the cost to pay someone to rewrite it). As your project was a "small coding project" written by a research assistant, the replacement value is actually rather minimal.

So now that you see that the code itself has limited value, you need to understand where you add actual value to the process (so that you can learn how to add more value - and receive more compensation in return).

A developer adds value to an organization by being able to:

  1. Correctly understand the actual problem which needs to be solved (as often the organization/person requesting the software doesn't have a clear understanding themselves, and you need to work with them to refine it);
  2. Implement a solution which is stable and scalable - so that less time is spent fixing defects and that the solution can work with larger and larger problems;
  3. Implement a solution which is extensible - so that as the owner's needs change, or the owner decides to share it with others, it is easy to add those new features. This allows that piece of code to solve more than one problem.

As your goal is to "receive recognition" and "better [your] reputation", and as those are forms of compensation, you need to focus on adding actual value.

To add value in your situation, you should embrace every potential user. As each of them will have a sightly different problem to solve, you will both develop an expertise at solving these sorts of problem (#1), and produce a piece of software which can solve many different problems (#3), including those for users which you haven't identified yet. Each of them will also exercise your code differently, leading to (hopefully) software which is more stable and scalable than if it had been developed for only a single user (#2).

As you want to pursue further education with this department - imagine how helpful it would be to your application if 2 or 3 (or more) researchers described how you produced an application which helped save them significant amounts of time, how you were able to quickly understand their problem, and translate it into a piece of working and performant software. That seems like a valuable thing for you to gain from this process.

  • 4
    "now that you see that the code itself has limited value, you need to understand where you add actual value to the process" - great answer, thank you! Aug 6, 2019 at 16:25
  • 2
    "Second principle: the code you wrote isn't special - there are literally millions of other people out there which could have produced the same, or better, code to solve that same problem." Boooo. He put work and energy into it, that's not valueless. It also requires practical skill and knowledge to write good code. You seem to underestimate the value of good code.
    – Andrew
    Aug 6, 2019 at 17:17
  • 14
    @Andrew - maybe I wasn't clear. I don't mean the code has no value, its just that the code's value is exactly the cost to rewrite it. My point is that newish developers think that they are producing something very special (because it is their baby), and don't realize that what they are producing actually isn't that special. If it takes an average developer 1 month to produce, it will take an average developer 1 month to reproduce. My point is that it isn't like a Picasso: It is the work of a craftsman. And this isn't an attack. I'm a professional developer myself. Aug 6, 2019 at 17:41
  • 3
    @Andrew - (continued). As a professional developer, you need to learn how to unlock the value you really bring, and understand that it is separate from the "machine" you build. Aug 6, 2019 at 17:45
  • 2
    @Andrew - I never said "anyone can do it" I said that there are "millions" of people who can do it - which is true: there are millions of software developers in the world. My point, which I guess came across too clunky, was that the value of a piece of software is not in its existence, but for the problems it solves. To be valuable as a software developer it is my belief you have to be valuable as a problem solver. Aug 7, 2019 at 15:08

I'm also a research programmer working in academia. We're lucky to be in a field where data and methods sharing is the norm. I, all of my peers, and I'd bet you as well, have all benefitted from decades of previous research being made public and available to us. It pushes scientific progress forward.

It's perfectly reasonable to want some recognition for your work, though. I'd suggest making a Github account and posting your work there, with a small write-up on how to use it. Having your work used by other researchers will be far better for your career than just getting a pat on the back from your PI. Being able to talk about the impact of a data analysis tool you released in application letters to grad schools will look very good.

  • 12
    I'd suggest the OP gets approval from their professor before posting it publicly, since this could be considered IP of the University. It may also be a situation where they will publish the code, but only after the research is complete, so timing might be an issue as well. Especially if they are competing for a grant. Even though they will share the code eventually, there's no reason to give competing agencies a free tool to help them get the grant, instead of you. Aug 6, 2019 at 16:16

I don't think you can protect your code from your peers. Universities normally have some pretty strict intellectual property clauses in their employment contracts. But this might also depend on the country you are in.

But in the end I think you are an employee of the university and your supervisor ordered you to produce something. This something will in the end probably belong to the university. You will probably have to face the fact that something created by you in lieu of your work for somebody else doesn't belong to you.

You could argue that this task is outside of the scope of your contract, but I don't really think this will work here and could seriously damage the relation with your supervisor.

Unless the code already exists under some license and you convince your supervisor to use this code I don't see any way to protect your code.


First of all, if you're only working as an RA for the money, you have nothing to worry about because your employer owns your code anyway, as covered in depth by the above answers.

But I assume you are also invested in the research, and have a desire to build a reputation as a researcher. In this case, it is important to understand that the main currency in the research community is reputation and visibility. Coauthoring and presenting research papers is one great way to boost your academic reputation, but releasing source code that is useful and widely used is another.

It is possible to release your code under a license that forces others to acknowledge you if they use your code, but I recommend against this course as unnecessarily antagonizing your users and reducing likelihood of adoption. Putting your name in a comment at the top of major source files and including a friendly note in the code/README along the lines of, "if you use this code, please acknowledge person XXX and cite paper YYY!" is usually sufficient.

Therefore, by default you should want your code as widely disseminated and used as possible!

That said, there are sometimes good reasons to need to keep the code private:

  • your supervisor feels that releasing the code risks scooping your research, or the research of other members of your lab;
  • your supervisor wants to "extort" other labs for coauthorship on papers or grants in exchange for access to the code (I don't condone this behavior, but it happens);
  • the research is sponsored by a company or government organization that requires keeping the code secret;
  • the code contains private data protected by HIPPA, FERPA, etc;
  • your supervisor/university wants to patent the algorithms used in the code, which in some jurisdictions requires limiting public release until after filing the application;
  • etc.

The bottom line: you should want your code used by as many people as possible, but talk to your supervisor about your concerns, and ask for permission before posting the code on a public GitHub or giving it away to others.

  • In addition to comments requesting co-authorship/citation/acknowledgment at the top of the source code and/or in a README file, consider also printing that exact message as part of the output. If the program's textual output is meant for human consumption, stdout is fine; if it's mean for downstream software to consume, write it to stderr Aug 7, 2019 at 0:19

You should be pleased that you have the opportunity to put such a project on your CV (resume), if used, this will definitely be a talking point for any near-future job prospects. In the grand scheme of things, in five years time you won't even be thinking about the project

To actually answer your question, vendors protect their code by distributing the binary file of the code (an executable file for example), which cannot be interpreted in a text editor

To demonstrate the point, if the program is written in Go and you distribute myProgram.go then your code will be shared, if you send out myProgram as a unix executable or exe file, then it cannot be interpreted

For Javascript, the obfustication can be done by minifying your file. This presents all your functions and variables in a more difficult to read format. Example: "myFunctionToSendOutAnEmail()" would be changed to "a()". Minified JS files have the extension myProgram.min.js as opposed to myProgram.js

  • 1
    This is utterly at odds, not only with the entire realm of academic research where the need that results be replicable means code is typically published in support of papers, but also with the very fact of being an employee and part of a collaborative team. The institution might decide to keep something in-house, but hiding it from co-workers is not viable. Aug 7, 2019 at 15:17
  • 2
    The purpose of my answer was not to answer the ethical question, but to other a method to protecting his work. It's not my obligation to make OP ethical, but I can share the knowledge to do something unethical Aug 7, 2019 at 15:27
  • 1
    The issue is not ethics, the issue is that your proposal is utterly unworkable in the situation of the question or anything like it. The person is not a business interacting with customers, they are an employee and collaborator on a team. Aug 7, 2019 at 15:29
  • That doesn't mean that they couldn't distribute binaries if they wanted to, so long as the program files are stored locally on their machine Aug 7, 2019 at 15:44
  • You seem to have no idea how a collaborate workplace functions or how non stone age software development works. No responsible supervisor would allow an employee or team member to keep critical source code secret from those with a realistically probable need to review, maintain, extend, and preserve it. Aug 7, 2019 at 15:50

You must log in to answer this question.

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