So the next time you feel the urge to overindulge with sweets, pay attention to what your mind is telling you. Notice your unkind thoughts. See if you can challenge or at least question them. Get off your back and on your side!
The compulsion overtakes your brain and pretty much shuts down your rational reasoning. The key in here is to "wake up," engage your conscious brain, and "observe" your primitive brain and the trouble it's getting you into.
The problem with this "good" and "bad" idea or thinking about food and eating is that it leads to weight gain over time. You end up on that yo-yo cycle. Even if it is not a ton of weight, you gain and lose that amount over time and you simply train your body to weigh more.
I'm suggesting that instead of beating yourself up for "failing" again to stick to your diet or plan, you rejoice that you overdid it. You see, the key to eating success lies in our so-called "failures."