I always feel like I've lost a little bit of myself when I lose code or IP I've created, even if I'm paid for my time.
I always feel like I've lost a little bit of myself when I lose code or IP I've created, even if I'm paid for my time.
You shouldn't. Because you haven't. You are greater that then sum of what you have done. You wrote it once, you can write it again (not exactly the same, of course, but you get the idea).
They can claim your work as their IP, but they can't claim who you have become in the process.
Can you? That code is now a trade secret for that company, and if you wrote a clone (or compatible version) using your knowledge of the product, that seems like a clear case of infringement.
Once you learn how to ride a bike, the owner of that bike has no claim to prevent you from riding another.
If (as an employee of that bike company) you developed a way to make the bike 20% lighter that wasn't readily discernible, you can't leave and start a competing company using that idea. The law around trade secret misappropriation is such a minefield that most companies separate the reverse engineering team from the implementation team (ie. clean room design).
A lot of these agreements teeter on the edge of enforceability, as well, and if you aren't forced to sign a non-compete it's going to be tough in most cases for a company to prove that a clean-room reimplementation violates the non-disclosure agreement unless you really are relying on information; however, I'd suggest that you consult a lawyer before wading into these waters, and 99% of the time it's not even close to worth the trouble. You're a lot more at risk from a lawsuit (even if you win) than the company is, and you shouldn't be burning most bridges anyhow.