If I hire a programmer to write code for a myspace application; does the programmer hold the rights to the application? how does that work ?
Every contract I've ever signed upon a freelance engagement has included a phrase to the effect that the client retains all rights to the work. Of course, every client also expects to benefit from all your previous experience ) But it would be inappropriate to get paid to write something for a client and then go and sell it yourself. The easiest way to protect yourself would be a simple contract and perhaps a non-disclosure agreement.