To start, I recommend an interesting article, "Ethics and software development," by Gary F. Pollice, a professor in the computer science department at Worcester Polytechnic Institute. (WPI offers a course, "Social Implications of Information Processing," which is mandatory for computer science undergraduates.) In his article, Pollice addresses privacy, encryption, trust, intellectual property, freedom of speech, and ethics in practice.
Programmers have an ethical responsibility to say "no" when they think their code will go into an unethical application. Granted, refusal to participate in a project could seriously damage a career and cause economic hardship, but we have an obligation to do no harm.
To me, using facial recognition software to link my presence in a store with my credit card purchases, and then display "target" advertisements, invades my privacy because it occurs in public, and the system owner has not asked permission to do so. If you plan to work on this type of project, I hope you will reconsider. We should be free from unauthorized tracking, monitoring, and intrusion.
Companies will always gather information about us, but it's the software that determines what someone does with that information. Again, software -- and programmers -- must do no harm.
Click here to read the Association of Computing Machinery "Code of Ethics."