I am a final-year college student entering the software industry as an engineer. My job will probably require me to write code all day for a company, using company resources and hardware (company provided laptop, etc.).
Suppose I also write code outside of work hours, on a personal computer, and the code is completely unrelated in any way to the product(s) that I work on, and to any of the product(s) the company develops. I use no company resources to develop this code.
Let's say some of this personal code starts to make me money, in the form of a business I incorporate. If it was not specified in my employment contract that the company owns all employee code, personal or otherwise, does my employer have any justifiable claim to my intellectual property, or to the profits from my business? Does this claim extend to time beyond my employment at the company (like, after I quit, and they learn I made money through an entrepreneurial side project while I was working there, can they sue for money)? Do the answers to any of these questions change if I did not incorporate a business, and just sold my IP as an unincorporated sole proprietorship?
In the United States (and, specifically in California), is it even legal for companies to have an employment contract where they own IP developed outside of company time? If it is, are there any legal loopholes around it (besides getting a new job, of course)?
I sincerely apologize if this is a known question or is inappropriate for this site.