Bad habits should be substituted with a good behavior in order to eliminate them. This is because some of the bad behaviors have benefits that we cannot do without.
These benefits include a sense of belonging that we get when we read many emails from our friends even though this affects our productivity, drugs to control your weight even though you end up abusing them etc. the benefits of such habits can only be retained if we substitute these bad habits with good ones. This way we will eliminate the bad habit and still keep the benefits.
Bad habits can also be eliminated by keeping company of people who live a positive life similar to the one you admire. These people will inject you with positive energy that will gradually eliminate your bad habit and replace it with the good habits you find in these people. Visualizing yourself succeeding also goes a long way in overcoming bad habits.
These visions create a sequence of thoughts that eventually end up ganging up against your bad habit. This forces you to drop them because all your brain does is give you negative thoughts about the habit. It is also important to prepare for failure.
Failure is part of human nature and the only way we succeed is getting back on track any time we fail. This way we get better and never succumb to stress that may entice bad habits.