Advisor wants copy of code to give to other student 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.
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.)