Don't shop while hungry and limit yourself absolutely every time you go out. If you're doing groceries, make a list, budget it and stick as close to it as possible, with maybe one allowed exception per shop (or something along those lines).
I guess I am lucky in that area because it is very rare that I am tempted by any impulse buying situation. I view all of that junk at the register as a bunch of stuff that I simply don't need and am not tempted to buy it. The funny thing is that even though these items are relatively inexpensive, they are total ripoffs when compared to the price of buying in bulk, especially drinks and stuff like that. You have to turn it around and look at it from the stores perspective. If they have to put it in your face to get you to buy it, then how good is it anyway.
The best way to avoid impulse buying is to take away the risk of temptation, whether its avoiding the situations or removing immediate access to your finances. Maybe you could bring a predetermined amount of money and leave the credit card at home. I personally don't have too much of a problem with it, not like when I was younger anyway. I guess the importance is in maintaining your priorities. After spending a while constantly asking yourself "do I really need this?" it will eventually become a good habit that you can maintain, and makes it easier to stop and reason with yourself. Self-discipline is something we could all afford to practice.
I don't resist impulse buying. That is why I have no money!! I am not as bad as I could be though. I will sometimes leave stores without spending everything I have. However, when I see something I want, if I have the cash in hand I am not very good at telling myself no. Also certain stores don't always have the same merchandise in stock the next time you go there...so my policy is to buy it now when I go there.