I have a grad student who wrote an algorithm, wrote the code and published a paper out of this. As a general policy in the lab, all code must go in public domain i.e. all code must be made open source.
Now I have another undergrad student who is developing an interface for this code. Provided that the code from the grad student above is available in the public domain. The undergrad can use the code and develop the interface for the said algorithm.
Now comes the writing paper part. Since the undergrad is developing the interface, the undergrad should be the first authors since the underlying algorithm code is in the public domain.
However, the grad student came into my office and ate my brain for half an hour for why he should be the first author on the interface paper. I want to pull my hairs out.