The view of Joel Spolsky regarding the issue.
Suppose you have a little game company. Instead of making software, you knock out three or four clever games every few months. You can't invent all the games yourself. So you go out and hire a game designer to invent games. You are going to pay the game designer $6,000 a month to invent new games. Those games will be clever and novel. They are patentable. It is important to you, as a company, to own the patents on the games.
Your game designer works for a year and invents 7 games. At the end of the year, he sues you, claiming that he owns 4 of them, because those particular games were invented between 5pm and 9am, when he wasn't on duty.
Ooops. That's not what you meant. You wanted to pay him for all the games that he invents, and you recognize that the actual process of invention for which you are paying for him may happen at any time... on weekdays, weekends, in the office, in the cubicle, at home, in the shower, climbing a mountain on vacation.
So before you hire this guy, you agree, "hey listen, I know that inventing happens all the time, and it's impossible to prove whether you invented something while you were sitting in the chair I supplied in the cubicle I supplied or not. I don't just want to buy your 9-5 inventions. I want them all, and I'm going to pay you a nice salary to get them all," and he agrees to that, so now you want to sign something that says that all his inventions belong to the company as long as he is employed by the company.