One of the main reasons many people "fall off the wagon" is because they have placed extreme restrictions upon themselves in their quest to lose weight. How many times have you heard "I'll never eat cake again" or similar?
But diets usually dictate denial of some form or another. I don't mean just cutting down on the overall calorie intake, because that really is necessary to lose weight I'm afraid, but cutting out specific foods completely; diets that tell you to cut out all carbs, all fats and sometimes (but vanishingly rarely) almost all protein. These are just crazy and pretty bad for you if you follow them for any long period of time. But there are the ones that -seem- sensible, like not eating any chocolate, cake, biscuits, chips, red meat, bread, potatoes...
Intolerance-finding diets aside; the problem with completely denying yourself something you really like is that the cravings get stronger and stronger and at some point it's very likely that you'll crack, give in, and binge. Because we are only human after all and there's only so much And then, because you've binged, the common thought is "well, I've ruined it all now so I might as well give up" or "I clearly can't do this diet thing, I'm so rubbish, I give up", maybe not right away, but certainly drifting that way and all of the hard slog to date is pretty much for naught; if not worse. Having a little bit of what you fancy every now and then, plan to have it and plan to have a small bit of the best kind of whatever you really really like maybe once a fortnight or once a week or, if you're one of the lucky people who really like something that's not all that calorific, plan it in as even a daily treat!
For me, I thought it was going to be cheese. I LOVE cheese. Really. Lo-o-o-o-ooooove it. But, I didn't get cravings for it at all during my weight loss phase. What I really REALLY wanted after some time of not having it was bread. Crusty, fluffy, white baguette, to be specific. Having stopped having sandwiches for lunch; as I just couldn't keep my daily kcals down low enough and still have sandwiches for lunch and a meal in the evening that meant my partner at the time didn't waste away totally as I liked to have the same meal together in the evening (though he always had twice the carb portion as I had and still lost weight!); I changed to salads for lunch. The salads were tomato based with some tangy bits added for flavour. But no bread or crutons with lunch salads and no bread or crutons with any soup, as bread is pretty calorific for the portion size. After 3-4 weeks of that all I wanted to do was buy a whole baguette, or even just a baton, and stuff the whole thing into my face. Thankfully, I nipped that in the bud by having a small piece of baguette with salad or a soup at the weekends for lunch. Yes, I still wanted bread with a vengeance, but I got a little top-up of bread every weekend which I'm pretty sure helped me not to go nuts with a baguette at any point.
So, if your thing is cake and you're trying to lose weight and stay on the wagon; have some cake! Really! Just make sure it's a small piece of really nice cake and only do it once a week, tops. And savour it; enjoy every tiny morsel and lick the plate at the end! Doing that isn't going to ruin your overall progress and it is very likely to stop you wanting to buy a whole Victoria sponge and scoffing the lot then hating yourself and potentially convincing yourself you can't do this weight loss thing. But be careful that your definition of a small piece doesn't drift bigger and bigger ;o) (And make sure you log it in your food diary and that it doesn't put you over maintenance calories for the day.)