I find that a combination of the two is ideal. However, every person’s body is different, and you have to find what works best for you and your body. There is no magic formula for every person. There is only one way for you. I tried joining a gym. Keeping track of everything that I ate throughout the day, etc. But I found that simply eating small meals throughout the day and walking to/from work works for me. I enjoy walking, and I live in an area where I can walk safely to and from work. I also don’t keep junk food in my apartment. If it is not there, how can you eat it? But these strategies are specific to me and my situation. It has taken me years of trial and error to get to this point where I am happy with my weight/body.