Part of it is just getting used to the local bugs - which does mean getting sick and building up your immune responses. If you are going to be in one country for more than a few days and don't have a very hectic schedule, it is probably worth taking the risk, enjoying the authentic local food from village street stalls, and getting on with life. You will get Bali belly, but there's a good chance that it will only spoil a day of your holiday and you can enjoy the rest more than if you stuck to tourist restaurants and avoided ice and salad and so on. If you are on a quick trip or have a tight schedule, don't take risks.