I'll give you an example: a while back I wrote some code in C, to push an element on to a linked list. I forget exactly why, but I ended up passing the head of the linked list as a "struct list " or something like that. That project died, but I kept the function just because I was so proud of it.
Years later, I saw a programming quiz. The question was almost exactly my task. The answer to the question was my function, with the variables renamed.
Independent invention. It ruins "Intellectual Property" as property.
And yes, I'm deliberating conflating copyright and patents, because the rest of the world does so. It's "World Intellectual Property Organization", not dual "World Patent Property Organization" and "World Copyright Property Organization".
I don't write software for a living right now, but I have in the past. Go right ahead and take a look: http://stratigery.com/source.html Take a copy, too. On the house.