You should take precautions of course--read inventions agreements very carefully--but I wouldn't at all go so far as to only do contracting. Especially if you live in California, as others have noted. Half the companies in SV were started by people working at Google or Facebook.
The salient details your scenario omits:
1. A lot of employees create side projects related to their employer's business and/or R&D activities. These are not subject to 2870's protections.
2. A lot of employees make the mistake of working on the side project during work hours or using their employer's equipment. Most employees who get caught up in these types of disputes claim they didn't work on the side project during work hours or using the employer's equipment but far fewer can make it through discovery with such a claim intact. There really is no wiggle room on this and one slip up can spell doom.
> We saw this just the other day on HN.
Assuming you're referring to Shred, no, we didn't. The matter there does not relate to a side project, although you can be sure that Smule will use discovery to look for evidence that its former employees were working on their idea before they left its employ.
You can read the actual claims at http://webaccess.sftc.org/Scripts/Magic94/mgrqispi94.dll?APP....
> Best thing to do: no side projects.
This is the best advice as far as side projects with commercial ambition or potential are concerned.
Thus my closer: when you are a full time employee, don't do side projects that you have ambitions to commercialize.
As I wrote, a lot of former employees who get caught up in these types of disputes make claims that they can't sustain through the discovery process because let's be honest: when you're working on a commercial side project that you're excited about, it's difficult to at some point not do some work (however minor) on it during working hours or using the resources of your employer.
Finally, if you take the time to read Smule's complaint against the Shred folks, you'll see that this isn't the case of an "aggressive" former employer. Smule presents a different version of events and appears to have some legitimate questions.
1. Employee creates side project
2. Employee quits to pursue side project as a company
3. Former employer decides to sue employee because they don't like it for whatever reason (this need not have any legitimate chance of winning in court, it could be entirely frivolous)
4. Former employee then has to decide between spending hundreds of thousands of dollars in legal fees fighting a lawsuit from the former employer or simply giving up
We saw this just the other day on HN. I've seen it happen to friends and colleagues.
Best thing to do: no side projects. If you have those ambitions, work as a contractor. The legal agreements are much more rational. You get paid for the hours you bill and are allowed to do any work you want outside of your billable time.