Diets fail because they're all about food. Better to lose unhealthy weight by exploring other passions... even things that aren't physical such as playing an instrument (or coding). Then over the long term you can start to consume less and less as you have food on the brain less and less.