Whenever I see a thread like this pop up on HN, I feel a need to reply and dispel some myths. I'm going to do my best to provide a quick, yet thorough summary. I hope this helps.
Who am I? I'm a techie and a fitness nut. I've played high level basketball, amateur football, rugby, aussie rules football. I've done some triathlons (not my forte), a couple ultra races (hate them, learned a lot about myself). My current area is gaining muscle, losing fat, and building strength. I write fitness books in my nights and weekends (no link provided).
I'll try to give the briefest of summaries, though I know it is going to be challenging. If I didn't summarize something well enough or if it is unclear, let me know and I can try to do a better job.
1. Calories vs Macros also known as Weight vs Composition
Calories matter for losing and gaining weight, but they don't tell the whole story. If the only thing you know about are calories, you can't lose weight or gain weight intelligently (ie. lose fat and gain muscle). You can do it by accident, but you certainly can't do it optimally.
But, I'll offer this, if the only thing you care about is the number on the scale, you can safely just track calories and eat in a deficit. You'll lose weight.
Macros, or macronutrients, are important to understand so you can achieve the goal you actually care about. Most people say "lose weight" and mean "lose fat". "Gain weight" actually means "gain lean muscle".
If that is true of you, you need to understand and track macros. And, no, you do not need to track both macros and calories. Macros are just fine.
2. Gaining Muscle
I wrote an entire book on gaining lean muscle mass complete with 3 workouts, nutrition info and a diet. I'm going to do my best to summarize it here as quickly as possible.
A. Workout with heavy weights (see workouts below).
B. Spike insulin after a workout (more on this in a sec).
C. Cycle your days.
Recommend:
For C, cycle your food in the following manner:
Workout days: 1g protein/desired lean bodyweight. Even simpler (if you hate math), just 1g protein/desired bodyweight. 1-2g carbs (post workout only)/desired lean bodyweight (this is more important to nail 100%), .5g fat(before workout only)/desired lean bodyweight.
Non-workout days: 1g protein/desired lean bodyweight. Even simpler (if you hate math), just 1g protein/desired bodyweight. 0-30g MAX carbs, .5g fat(before workout only)/desired lean bodyweight.
For B, you can see above that I'm recommending carbs post workout. The goal with the carbs is two fold: to replenish glycogen stores and to spike insulin. If you are diabetic or for some other reason can't eat carbs, you can still spike insulin, though not as fast and not as high. If no carbs, do the following: protein shake with creatine, leucine (5-10g) and MCT oil (prefer straight MCT, but coconut oil will do as well). (Note: this is the same shake I use in the 'lose fat' below to still build some muscle while losing fat).
3. Losing Fat
Again, I wrote an entire book on this, so I'll do my best to summarize. Remember, lose fat probably means 'lose fat and maintain whatever lean muscle mass I currently have' .
A. Workout with heavy weights (preferred, mostly to maintain your muscle mass...need to continue to stimulate the body), sprints/HIIT, or very low intensity walking (mid-level cardio, i.e. running is bad for this goal, just FYI).
B. Spike insulin without carbs post heavy weight workout. If HIIT or low intensity cardio, NO insulin spike.
C. Carbs once a week.
For A, I prefer people to continue to workout with heavy weights simply to make sure they can maintain their muscle, or even pack a bit more on.
For B, just use the same post workout shake above. Again, if workout was HIIT or low-intensity cardio, don't do this.
And for C, follow "non-workout day" above and go ultra low carb for 5-6 days a week (in a row). Then carb-refeed (also called carbing up) once or twice a week. I highly recommend you start out with this approach:
6.5 days ultra low carb (less than 30g/day) and then on the 7th night, have a 6 hour window where you eat basically whatever carbs you want. On the order of 300-700g of carbs in that window. The next day you are going to feel pretty bloated and you'll gain weight (water), but in 2-3 days all that is gone and you are back to losing fat. The reason for the .5 days of carbs is hormonal adjustment.
I initially intended to write much more, but this is already getting too long for a HN post. It is really hard to summarize everything down to the barest of essentials, so I hope I did an adequate enough job for people to get a start.