In the work life, one needs to be strategic; it appears to me that most people on here who are commenting somewhat negatively about people giving 2-week notice and nothing else have never been laid off or fired or somewhat "mistreated" by a company.
The way to be an excellent employee is to always deliver work to the best of one's capabilities and give 2-week notice before leaving. In one company I worked for, somebody gave a 2-week notice and was let go immediately. It is not unheard of, and most legacy companies could not care less about a possible PR problem. Those legacy companies live in a galaxy that is far away from the one inhabited by start-ups and similar good PR-dependent companies, they are populated mostly by old dinosaurs that recruit heavily among the not-too-brilliant technical people.