However, just as important, if not more important, is diet. When counting calories, exercise is no substitute for eating less. Whatever diet you end up using (I have my own strong opinions on that but I'll refrain from sharing those here) it is critical for health and well-being to stay within a healthy bodyfat range.
Also, one more thing about that thread. I mentioned leangains and starting strength. Starting strength is excellent for getting strong. Leangains isn't. Leangains is wonderful for getting thinner while retaining your strength. For building muscle, a modest caloric surplus seems to work just as well as, if not better than, intermittent fasting. I'm developing a website that explains more, which will hopefully be launching in the next month or two.