Earlier quoted context omitted.
Yeah, I have been working for Rails shop that did exactly this. I wasn't able to do anything, not even in my spare time, to contribute to open-source projects or do other work. The other work I can understand, because I could help a competitor for an example. But that they owned ownership for every line of code written by me, even on my time off, was killing my inspiration.
Is this even legal ? In Switzerland, I don't think an employer can claim ownership of a piece of work that was produced on the employee spare time (and on his own computer and so on).
The problem from the employee's point of view though is that it may have to come to court before the employer will back down and there are costs in terms of money, time, and relationships associated with that especially if the company goes for the appeal cycle afterwards. Most individuals can't afford the time or cost of such a case (though costs are likely to be recovered from the company eventually, you need to find the funds up front) if it comes to that, and the software industry can be fairly judgemental and nepotistic so it'll be hard work getting a new job (once life becomes unpleasant at the old one due to the court case) now you have a reputation for being difficult. These considerations are why individuals back down quickly, as the assume the conversation will go:
Company: We own that.
Individual: No you don't.
Company: Contract says so.
Individual: You can't enforce that.
Company: We can try. Wanna fight?
Individual: Er, no. Here, take it.
Companies know the clause is not legally enforceable, but they have it in there because they know it generally doesn't have to be as most people will not argue as far as the legal status of the clause being relevant (in fact most people don't even know that it isn't legally enforceable). This is particularly the case for younger people or those otherwise near the start of their career.Most non-compete clauses are in a similar legal position.