And it makes sense.
Much of the technology involved is intellectual. You hire an engineer and you have to teach him the technology. It's part of his toolkit. It's the same with a lot of engineering practices.
Now, if you're a mechanical engineer and you take a patent with you (in your head, in your toolkit) and use it, you sell copies of a machine that people can see and say, "Ah, you've stolen my patent."
Try that with software. You move to another company with that patent or trade secret in your head and you can command big bucks, until you've shared the secret at the new place. Code's written, the technology's used, and unless it's clearly visible after compiling few will ever know about the patent or copyright infringement. Even if you uncompile the code, you're stuck having to pay people a lot of money to scrutinize and spot the infringement in the code.
Now consider something like Microsoft, which has a lot of people trying to find hooks into its software so make sure that their software is compatible with or can substitute for yours. Then it's not *copying* the code that can lead to problems, it's just knowing how the code works well enough to be able to interact with MS products, etc.
This, of course, includes when MS wants to pick up on competitors' secrets and outdo them or incorporate them.
Non-competition works best. It helps stability for a company's workforce, it reduces the temptation for an engineer to do something illegal for big $ and probably get away with it. It keeps MS from being pulled apart, but can also keep MS from easily pirating smaller products' lines as easily.
At the same time it's illegal. One of those cases where in principle you're against it, but you realize that the outcome is likely to be worse and lead to people jumping ship so they can say, "Hey, I got mine!"