A simple but effective mental strategy can keep you from overeating this holiday

Things were going well enough for you during the first few weeks of your new plan to eat better, but then the holiday season arrived, and now you're facing an uphill battle of resisting extra helpings of ham, freshly-baked cookies, and sugary cocktails.

How could you possibly say no to seconds and thirds when it would be a personal affront to Grandma?

Thankfully, Gretchen Rubin, a renowned habit expert and author of "Better Than Before" and "The Happiness Project," offers a simple but effective technique to keep new habits on track: anticipate failure.

This doesn't mean you should accept that you are destined to fail. Instead, it's about anticipating your barriers to success and planning ways to circumvent them.

"Most of the problems that come up with our habits are foreseeable," Rubin told the audience at the Fast Company Innovation Festival. "We know the kinds of things that tend to trip us up and the kinds of interruptions that can happen in our routines, so you can anticipate them."

The technique is simple: Recognize your trigger — "If X happens" — and plan a way to circumvent it — "then I will do Y."

Having a plan in place from the beginning eliminates the need to make a decision when temptation rolls around and our willpower might not be at its optimal level.

Rubin provides a useful example of how it could work during the holiday season: "If I go to a holiday party, then I will stand very far away from the buffet table, then I will have one drink and not more drinks, then I will hold a drink in one hand and a napkin in the other so I can't take anything from the hors d'oeuvres tray — whatever you need to do."

Related: The 10 most popular 'superfoods' in the country:

10PHOTOS

10 most popular superfoods in the US

See Gallery

10 most popular superfoods in the US

#10 Bulgur: 1,300 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Getty)

#9 Flax: 5,400 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

#8 Coconut: 14,800 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Getty)

#7 Cauliflower: 18,100 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Getty)

#6 Almonds: 18,100 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

#5 Kefir: 22,200 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

#4 Blueberries: 22,200 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Shutterstock)

#3 Turmeric: 33,100 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Getty)

#2 Kale: 40,500 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.

(Getty)

#1 Avocado: 49,500 searches/month in the U.S.

Data released by Search Laboratory is based on Google’s trend report and data from Google’s Keyword Planner.