Coding in Flow logoGet my free React Best Practices mini course
← Blog

How to Stay Fit and in Shape as a Programmer

Sep 25, 2022 by Florian

Featured image

In this post, I teach you how to lose body fat, build muscle mass, and stay healthy as a programmer who spends most of his/her time in front of the computer.

Table of Contents


As a programmer, it can be very easy to get out of shape. We spend a lot of time sitting in front of the PC, only moving our heads and fingers, often with unhealthy snacks in arm's reach. Deadlines and tight schedules sometimes require us to work extra long hours, leaving little time for exercise and lots of stress instead.

The cliche of a programmer is that of a person who is unhealthy, overweight, and physically weak. Already as kids, a lot of us were more interested in technology than sports and much rather spent our time in front of the computer than with the other kids on the soccer field. That might be okay when you're young, but as a grown-up person, you have to take responsibility for your body and health. If you don't, both will decline at an accelerating pace, you will accumulate illnesses and physical pains, it will become harder to focus and function properly, and eventually, you won't even be able to do the things you enjoy anymore.

Don't let a cliche be an excuse to treat your body like a bag of trash that has to be disposed after a short lifetime. There are many people who manage to maintain both; a healthy and fit body and a fun job in front of the computer. Of course, this requires some effort, but maybe it's not as hard as you think. As with everything, the people who get results are the ones who are consistent and do the basics right and for long enough time. You just have to find an approach that works for you.

Getting fit and in shape has different components to it. If you're overweight, you need to lose fat. You also want to build and maintain some muscle mass. Even if you don't care about getting big, some muscles are required not only for physical but also for mental health (more on that later). Of course, you should also train your cardiovascular endurance which is required for a healthy heart and body, in other words, you need to do cardio exercises.

This post is divided into different sections that each cover one of these topics. I lay out all the knowledge and experience I have acquired over many years that have kept me lean, muscular, and healthy up into my (now) thirties. I give you tips and tools to lose body fat, exercise routines to get you started building muscle, and a few legit "lifehacks" that make these things a bit easier. If you're impatient, you can jump to a particular section that you're interested in. But I recommend that you read the whole post from top to bottom.

A muscular male torsoMe at 175 cm and ~78 kg. Photo from yesterday. I only lift weights 3 times a week.

Losing Body Fat

Calories in vs calories out

Your body needs energy to function and move, which, for food, we measure in calories (short "kcal" for 1 kilocalorie or 1000 calories). Excessive calories are stored in form of body fat, which your body can draw from in times of famine.

The most basic fact of dieting is that in order to lose body fat, you have to consume fewer calories than your body uses up (called a "caloric deficit"). This simple truth is caused by the first law of thermodynamics, which states that energy can't be created or destroyed, only transferred. This is also true for your body, which has to take energy away from its reserves if there isn't enough new energy coming in through your mouth. In other words, it has to burn body fat.

And yes, there are nuances to this, like certain food types getting metabolized differently and drugs that affect weight gain. But the effects of these factors are usually smaller than people think and they are still bound to the laws of thermodynamics. If someone doesn't lose weight, it's almost always because they wrongly estimated their energy balance—how many calories they consumed vs how many their body actually burns.

Here's a "secret" that many people don't get: The Ketogenic diet, intermittent fasting, low-fat diets, eating more often, eating less often, eating only cole slaw, all these different diet forms and fads make you lose fat in the exact same way: By having you consume fewer calories than you burn. The reason why some diets work better for certain people is that they make it easier for them to eat less. Not eating carbohydrates, for example, helps many people lose fat because carbs tend to make you more hungry while fatty foods are more satiating. And having less variety in your meals generally makes you eat less (This is called the "Buffet Effect").

All diet forms (low-carb, low-fat, fasting, more meals, fewer meals, ...) make you lose fat in the same way: by helping you consume fewer calories than your body burns. For some people, it's just easier to eat less if they avoid certain foods.

Here is a study that compared a low-fat and a low-carb diet and found no differences in weight loss or resulting body composition between the two diet forms.

What you eat doesn't decide if you get leaner or gain more fat, only your calorie balance. I know it from first-hand experience because I bulked myself fat with healthy foods like oats and nuts before (because I simply ate too much of them), and later lost 15kg of that body fat again with an if-it-fits-your-macros diet where I had kebab and ice cream almost every day. Of course, both of these phases were not particularly healthy and these days, I maintain a much more balanced diet.

How do you find out how many calories your body burns every day? You can use a TDEE (total daily energy expenditure) calculator, like this one, as a starting point. However, they are never completely accurate, and the only way to be exact is to actually measure your calorie intake for a while. Track the food you eat in an app like MyFitnessPal for at least a few weeks, and observe your body on the scale and in the mirror. If you consistently gain weight over this time frame (ideally measured first thing in the morning), you're in a caloric surplus. If you're losing or maintaining weight, you're in a deficit or at maintenance respectively.

Eating healthy still matters

If it's only about the calories, then why are people who eat healthy usually in better shape, you might ask. That's simple: Healthy foods are more satiating because they have more fiber and fewer calories per volume. Veggies are, of course, the prime example here. Even if you fill up your whole stomach with them, they only provide you with a small amount of calories, but lots of micro-nutrients that are essential for health. Eat a chocolate bar, however, and you easily consume hundreds of calories of low nutritional value and then want to eat even more afterwards.

What you eat matters for your health and energy, and a healthy diet also improves your mood and productivity. But fast food and sweets only make you fat indirectly by making you hungrier. And in moderation, they can be incorporated into an otherwise healthy diet.

Healthy foods make you lose weight only indirectly by being more filling and less calorie-dense. You can lose weight and body fat on fast food too, it's just harder because you will be more hungry.

Let common sense be your guide. You likely already know which foods you should eat often and which ones you should only have occasionally. It's just a matter of actually being disciplined about it. When you start eating less processed food, your taste buds also adapt and learn to enjoy basic foods again.

Personally, I don't follow any special diet form. I've tried many of them, but what works best for me is simply tracking my daily calorie intake in MyFitnessPal and making sure that I keep most of my food choices healthy and satiating. For example, I eat whole-grain bread instead of white bread, because it's more nutritious and filling, and I eat dark chocolate instead of the more sugary ones. I also start most of my meals with a big plate of vegetables. These food choices make it easier for me to not overeat and provide me with important nutrients.

A plate with different colorful vegetablesTip: Starting your first meal with a big plate of vegetables will make you less likely to overeat

I don't have anything against stricter diets like the Ketogenic diet, though. They can work really well for people who have trouble maintaining a calorie deficit on a regular diet. If you've been battling with overweight for a long time, it can be worth looking into these diet protocols. However, I'll show you a less strict form of a weight loss diet, which I also use myself, next.

How to get lean

In order to lose body fat at a sustainable and healthy pace, a calorie deficit of about 500 kcal per day is considered a good target (I explained how to figure out your daily caloric expenditure in the previous sections). Since one kilogram of body fat stores around 7000 kcal, you'll lose about half a kilogram of fat per week this way (roughly 1 pound). If you're very overweight, increasing the deficit up to 1000 kcal/day can be fine, but this also makes the diet harder.

Of course, the difficult part about maintaining a caloric deficit is appetite. And generally, the leaner you become, the hungrier you get, because your body notices that its reserves are diminishing. To combat this problem, I recommend removing all major carbohydrate sources from your meal plan for the duration of your weight loss phase. Leave out bread, pasta, rice, oats, candies, and juices, and instead consume your calories mainly through proteine and fat. That means you eat mostly veggies, meat, nuts, eggs, and everything that's low in carbohydrates. The difference to a full-blown low-carb diet, like the Ketogenic diet, is that you still allow yourself fruits and other foods that contain some carbs. Your body doesn't need more than a few carbohydrates and they have a tendency to increase appetite, but going too low in carbs can make you feel pretty bad and skyrocket cravings. Again, for some people, this works really well, but for me, it didn't.

You should track your food intake in an app like MyFitnessPal, at least for the duration of your cut. This makes it easier to hit your exact calorie goal so you're neither starving nor overeating. These apps have barcode scanners with which you can add foods quickly and easily. When you're eating out or at your company's canteen, estimate the calories by comparing it to food you've eaten at home before. This is difficult at first but becomes second nature with practice. Tracking an estimation is still better than tracking nothing (and then using that as an excuse to overeat).

Some people can lose weight without counting calories, but they're playing in hard mode. It's just too easy to underestimate how many calories you've already consumed, especially when you drink some of them in liquid form. By knowing your exact calorie balance, you can also incorporate some treats here and there if your window allows it, and still progress.

I recommend drinking only water, tea, or coffee. Diet sodas have no calories and you can theoretically drink as much of them as you like (I did that for many years in my twenties), but they are still bad for your teeth (because of the acid) and also your gut health. Water, although boring, should be your beverage of choice most of the time (I talk more about caffeine later in this post).

Cutting body fat should ideally be combined with a weightlifting routine to combat muscle loss and increase your total calorie expenditure. I will show you a good beginner to intermediate weigthlifting routine and give you tips on muscle building further down below.

Cheat meals

When it comes to cheat meals (allowing yourself foods that you should normally avoid), the basic math still holds true. If you spare 500 calories a day for 6 days a week, but then have a surplus of 1000 calories on the 7th day, your total calorie deficit for that week is (6 x 500) - 1000 = 2000 kcal, or about 285g fat. You have to decide how fast you want to progress and this dictates how much "cheating" you can allow yourself. A whole cheat day can ruin the weight loss progress of a whole week. I recommend skipping the idea of cheat meals altogether and instead trying to fit smaller treats into your macros (and calories).

Intermittent fasting

Earlier I said that restrictive diet forms don't work for me as well as eating a moderate and balanced diet does. However, I'm a huge fan of intermittent fasting and have been doing it for years. Intermittent fasting means that you shrink the time window in which you eat throughout the day. You don't eat breakfast right after waking up, and you don't eat too close to bed. A common form is 16/8 fasting, where you eat in an 8-hour window every day and fast for the remaining 16 hours (including sleep). But this is not set in stone and 18/6 or 15/9 works just as well. Sometimes I eat all my calories in just 1 or 2 hours. The important part is that you give your stomach extended periods of time in which it doesn't receive any new food.

Intermittent fasting brings a wealth of health benefits but it also helps with not overeating because many people are just not that hungry in the morning and can go for hours without food without a problem. This way, you have more calories to spend in a smaller time window, which allows for bigger and more satisfying meals. Don't worry about losing muscle in these fasting windows. Your body has reserves to draw from and many people with great physiques do intermittent fasting. You just need to eat enough calories in total.

Intermittent fasting is especially helpful when maintaining a calorie deficit, but I also do it when I'm not trying to lose body fat and eat ~3000 kcal a day. It helps me not overeat (I became very hungry after my early twenties), and focusing on work in the morning is also easier with an empty stomach. Plus, food just tastes much better when you're a bit hungry. However, if you have trouble eating enough calories (as is often the case for younger people) eating more often will probably work better for you. I will give tips for so-called "hardgainers" later in this post.


Cardio exercises are exercises that raise your heart rate and train your endurance, like running, swimming, and cycling. They are good for your heart, reduce the risk of many diseases, and boost your energy levels and happiness.

However, just like eating healthy, doing cardio only makes you lose fat indirectly by influencing your calorie expenditure and appetite. You can cycle miles every day and still be chubby, and you probably know people who do physically laborious jobs but also have a beer gut. Not only is your body very efficient at burning as few calories as possible for physical activities, your appetite also increases as you move more. However, anyone who says that cardio isn't helpful at all with weight loss probably doesn't have first-hand experience.

When you run for an hour you burn the calories of about half a pizza, which is not a lot. However, exercising also blunts your appetite for a while and can turn you from ravenous into not hungry at all for a few hours. If exercise sessions are well-timed, they can be extremely helpful for weight loss. Let's say, for example, it's 6 PM, you've already eaten all your calories for the day, but you've gotten hungry again because you're on a caloric deficit trying to lose fat. Then it makes a huge difference if you're just sitting at home, being bored and with foods in arm's reach that you're constantly thinking about, or if you're instead out for a run that distracts you from your appetite for a while and leaves you with some extra calories to spend. Cardio works for weight loss, it's just not a hall pass to eat whatever you want.

I don't do a ton of cardio. Besides my weightlifting routine and 1-2 martial arts sessions a week (more on that in a moment), I usually run on 1-2 other days for about 30 to 60 minutes each. Additionally to that, I use my bike instead of a car to move around the city and I sometimes use the stairs instead of the elevator. These little things add up and help you stay fit and burn more calories every day. On the 1-2 remaining days where I don't exercise, I like to take long walks through the park while listening to a good podcast or audiobook. It's relaxing, it aids physical recovery, and it can help solve difficult coding problems by taking the mind off the code for a while (all forms of physical exercise have this effect). And you also get some sunlight exposure this way.

Some more tips

Over the years, I found a few lesser-known tricks and "hacks" that made it easier for me to lose body fat and maintain a good physique, additionally to the fundamentals I explained above. One of these tricks is this protein fluff recipe from Youtube. It's a very simple recipe that has less than 100 kcal per serving but creates a huge volume of edible fluff that fills you up for a while. It tastes pretty good if you add some flavor drops and mix in a few grams of cocoa powder. When I'm trying to cut body fat, I eat one of these before my first real meal and one later in the day. This makes it much easier to stay satiated and it only costs me a few calories from my daily balance. You'll need a food processor for this recipe though because it requires mixing for several minutes.

Caffeine blunts your appetite for a while but it often comes back with a vengeance later. I talk more about caffeine and why you shouldn't consume it more than once or twice a week at the end of this post.

As a more natural alternative that doesn't require consuming any substances, simply being busy can make it easier to ignore hunger. When you're really engrossed in a coding project or some other task, you just forget about your appetite for a while. This is why focused work in the morning goes so well with intermittent fasting; you have laser-sharp concentration and you ignore your hunger for a few hours.

Another simple but effective tip is to just not have any of the foods at home that you're trying to avoid. This might seem obvious, but I often hear of people who "accidentally" ate a bag of potato chips or sweets because they gave in to their cravings. Then I'm wondering why they had these foods at home in the first place, especially if they were trying to lose weight. It seems like a backdoor they keep open for themselves to quit their diet when they feel like it. When you're trying to lose fat, it's better to stick to more filling desserts like fruits, porridge, and dark chocolate (at least 80% cocoa) and don't even buy any of the unhealthy, high-calorie stuff. If you don't have it at home, you can't eat it, no matter how big your cravings are.

A standing desk increases your calorie expenditure slightly. It's not enough to make you lean but standing more often is great for your health and posture, so I recommend them to everyone. You can find good ones on Amazon. Tip: Get an adjustable one that allows you to both sit and stand.

Lastly, lifting weights and building muscle are extremely helpful for keeping your calorie balance in check. This is what we will focus on in the next section.

Building Muscle

Muscles make you smarter

Most people are aware that strengthening your muscles improves your posture, bone density, overall health and well-being, as well as your self-confidence. But did you know that building muscle mass also improves your intelligence and protects your brain from cognitive decline and diseases as you age? The cliche that people with muscles are dumb couldn't be more wrong.

Building more muscle mass makes you smarter and protects your brain from cognitive decline as you age:

Working out in the gym is also a great stress reliever and helps you take your conscious mind off a problem for a while, which is important for problem-solving. That's why I don't recommend working out first thing in the morning as a programmer. It's much more strategic to first give your brain something difficult to work on, and then go exercise and let it process the information in the background.

You don't need to become jacked to reap these benefits. And you don't need to spend hours in the gym every day. Just make sure that your muscles don't atrophy from sitting all day.

If you are a woman, you should follow the exact same advice I'm giving here. Many women are scared that lifting weights will make them look too muscular and manly, but this worry is completely wrong and unjustified. Since your testosterone levels are much lower than that of a man, you also build muscle mass much more slowly. Unless you inject testosterone into your body exogenously, you won't suddenly become "too big". On the contrary, building muscle makes the female body look great and healthy. This also means that you shouldn't shy away from heavy lifts, like squats with weights or even deadlifts, which I will explain later in this post.

Building muscle vs losing fat

Dieting for building muscle works the same as I explained in the chapter about weight loss: You should eat healthy and pay attention to your calorie balance. The only difference is that while you need a calorie deficit to lose weight, you need a surplus to gain weight. This also means that you can't lose fat and gain muscle at the same time. You have to decide which one you want first, depending on your starting situation. Some say it's possible to build muscle and lose fat simultaneously when you're just starting out, because your body is so receptive to the growth stimulus as a beginner (so-called "newbie gains"), but this will stop working once you're past the absolute beginner stage.

There are no exercises for "toning", that's just an old myth. You tone your muscles only by losing body fat.

After you reached your desired body fat percentage, doing a weightlifting routine can help you stay lean. Again, it does so only indirectly by allowing you to eat more. But compared to cardio training, the calorie boost of weightlifting is two-fold: You burn calories from the training itself, but additional calories are then used by your body to build new muscle mass. This way, weightlifting (and in particular bodybuilding) allows you to eat even more food than cardio does. Of course, you should still do cardio for health reasons and to boost your metabolism on days when you don't lift.

Eating the right amount of calories is just as important in your muscle-building phase as it is when you're cutting weight. If you don't eat enough, you will stop building muscle mass, no matter how hard you train. That's why so many people work their faces off every week at the gym but don't make any visible progress; they simply don't eat enough. Others do the opposite mistake and eat too much, they get big and strong, but also increase their body fat too much. What many people blame on their "body type" in reality has much more to do with how they eat. I can tell you that from my own experience because I went through both phases; thin and lean to bulky and strong, as you can see in the images below. In the third picture, I figured out my optimal calorie balance, cut some body fat, and ended up with a much more aesthetic physique.

A comparison of the same body at three different training stages and body fat percentagesBody types are mostly an excuse. How big or small you are depends on your training and your diet.

Diet for building muscle

It's good to aim for a calorie surplus of 300-500 kcal per day to build muscle mass while minimizing fat gains. I explained how to estimate and track your calories in the chapter about weight loss at the beginning of this post. Of course, you should still maintain a healthy and well-balanced diet. If you have trouble eating enough, as many young people do (so-called "hardgainers"), it's okay to implement more calorie-dense food choices and even fill up your calorie balance with some sweets and snacks. A better alternative, though, is to buy a blender and create healthy weight gainers, like mixing oats with milk and peanut butter. Nuts are also healthy and very high-calorie, so use them if you have trouble gaining weight.

If you think that you "can't gain weight" you're just not counting your calories correctly. Many young people think they eat "a lot" because they eat fast food here and there, but when you actually observe their diet, you realize that they also skip entire meals or have days where they only eat very little. Again, the diet over the whole week is what matters, not just single days. If you eat 4000 kcal on one day but only 1500 kcal the next day, that's an average of 2750 kcal/day, which is not enough for young active people to gain weight.

There has been a lot of debate about how much protein you actually need to build muscle mass. 1.5 grams of protein per kilogram of body weight (or 0.7 g per pound) should be a good target. If you pick healthy food choices and eat protein-rich foods like lean meat (chicken) regularly, you probably don't need protein shakes or the like. However, they also don't hurt (only your purse). Again, tracking your food in MyFitnessPal will give you a very clear picture of how much protein you consume.

In terms of supplements, most of them are unnecessary and just a way for companies to make money from you. Before you take something, research it properly, and make sure that your training and diet are optimized first. One of the few supplements with actually noticeable effects is creatine, which will give you a slight strength boost. Creatine is considered safe and can be bought for relatively cheap. Omega 3 fish oil is said to have beneficial effects on health and mood. It's worth reading up on this as this is outside the scope of this post.

Beginner to intermediate weightlifting routine

I can't explain all the ins and outs of different exercises and workout routines in this post, but I'll give you a good starting plan that you can use if you are a beginner and even as an intermediate. You can train after this plan for several months without having to change anything about it. If you do the nutrition part right, you'll make significant muscle mass and strength gains.

Your exercise plan should always focus on compound lifts first (exercises that involve large chains of muscles rather than isolating only a few ones) because they improve intermuscular coordination and make sure that all your muscles look in proportion to each other. People who focus on isolation exercises often look goofy with some muscles too big and others too small. An unbalanced body can also cause health issues and pains.

Here's the plan. I added links to Youtube tutorials for each exercise so you can learn the correct form. You can also let someone else check your technique, either a trainer at your gym or someone over the internet. Just make sure that they know what they're talking about. I've never injured myself in 10 years of training, even while deadlifting more than 160kg.

Day 1:

Day 2:

Alternate between these two training units with at least one day off between training days. You can do Monday/Wednesday/Friday or go every other day. Do 3 sets of each exercise and aim for 8-12 repetitions, where the last repetition should be hard but still be doable with good form. This means that you should increase the weights regularly in small steps. You can track your training plan and progress in an app like JeFit (which I use myself).

You don't need any other exercises in the beginning. All your muscles, including your biceps and triceps, are covered by these compound lifts. I know people who are absolutely jacked who never do anything else than these exercises. You should focus on learning how to do them properly because they belong in every good weightlifting routine for a well-rounded physique. Try to not leave out any of them, because they are all important. Especially squats and deadlifts are very effective at putting on muscle mass and improving your posture. I never have back pain even though I don't pay much attention to how I sit. But I've been deadlifting for a third of my life.

Because this routine is so simple, you can even do it with a very basic home gym if you don't have a real gym near you. You'll need a bench, a barbell with about 100 kg of weights, a pull up bar, and a stand where you can do squats between. For a long time, this was all I was using.

A very rudimentary home gym with a bench, barbells, weights, and a pull up barMy old home gym. It had all you need for an effective full-body training.

You only need to invest 3-4 hours per week for your weightlifting routine, which should be doable for everyone even if you have kids. I recommend not taking additional days off, because sickness, holidays, job, and other life circumstances will naturally require you to skip some training days here and there. Just make sure to get back on track afterwards and pay equally as much attention on your nutrition and calories on your off days.

Once you're more progressed (after several months to one year of training) and you want to continue adding more muscle mass, you'll need to set some new impulses to trigger further muscle growth. This can be through adding some smaller accessory lifts additionally to your compound lifts, or by finding ways to make your current lifts more intense, like drop sets, partial reps, or any of the countless other intensity techniques you can find on Google. You'll need to vary your training routine from time to time to not stagnate, but the major compound lifts should always be included in some form.

Other Sports

Weightlifting and cardio exercises like running, cycling, and swimming are the most direct ways to keep your body fit and in shape. But of course, there are other sports that are fun too and maybe you enjoy them more than moving weights up and down or running all by yourself. If you do any other sport that gets you out of breath and your heart rate up regularly, like martial arts, for example, it can count as your cardio routine.

I still like to run at least once a week but that's up to you. I would, however, always do a weightlifting routine, because barely any other sport gives your muscles the necessary impulse to grow and get stronger. Even just doing one full-body workout per week can be enough (Basically all exercises of the beginner plan I mentioned above, done on the same day). Two are great. Just make sure to have at least one rest day per week, where you don't do more than a walk outside.

Weightlifting and running tend to be very lonely activities. Joining a sports club can be very good for your mental health because you train with other people, get more social interaction and sometimes even find real friends there. Having a trainer who pushes you can also be the necessary motivation you need to actually train hard. I can recommend Brazilian Jiu-Jitsu. It's a very intense but fun sport, it teaches you useful self-defense skills, and as opposed to boxing or other combat sports, you don't get hit in the head, which we should avoid as programmers.

Two men sparring Brazilian Jiu-JitsuBrazilian Jiu-Jitsu is a fun sport that trains your endurance and strength, teaches you useful self-defense techniques, and builds new friendships

Staying Motivated, Caffeine, and Sleep

Your motivation to exercise, caffeine, and sleep, are all interconnected so I cover them together in this section.

As I mentioned above, certain sports might be more enjoyable to you than others, so try out different things and find out what you enjoy. Sometimes just changing your surroundings can make exercising more fun. For example, I really don't like lifting weights at home or in a gym that's empty. Even though I have social anxiety, I'm much more motivated to lift in a gym full of people because this somehow energizes me.

When I'm running or going for a walk, I like to listen to a good podcast or audiobook. It can make the time go by much faster. When I'm weightlifting, however, I usually need more focus and podcasts are too distracting. Then I just listen to music I enjoy and that pushes me.

Caffeine, of course, is another powerful motivator because of its effects on dopamine. However, I highly recommend that you don't consume caffeine more often than on 1-2 days per week. If you drink it daily, your body just gets used to it, the positive effects disappear almost completely, and all you're left with is an addiction. How many people need their daily coffee just to feel normal? Getting off a caffeine addiction is not that hard. Just stop consuming it for a few weeks and then return to a more reasonable consumption frequency. I drink my Yerba Mate only on Sundays and it always feels amazing because the effects of the caffeine are really intense. Not drinking it every day also keeps my teeth from turning green.

Be aware that caffeine has a very long half-life of about 6 hours, so it stays in your system for longer than you might think. Studies have shown that consuming caffeine even long before bad can diminish your sleep quality significantly even if you think you're sleeping deeply. Here is a nice caffeine half-life calculator you can use to find out how much is still left in your system when you go to bed. Obviously, this value should be as low as possible, ideally zero. On my caffeine days, I drink two cups of Yerba Mate in the morning, and that's it. It gives me a nice kick for several hours and when it's time to go to bed, most or all of it is out of my system.

Never compromise on sleep. It's the most important tool for your health, well-being, and effective learning. In programmer terms, sleep is what moves the stuff you learned over the day from your RAM into your long-term storage. Without enough high-quality sleep, a lot of that effort is wasted. I recommend reading the book Why We Sleep by Matthew Walker if you want to learn more about sleep and its great importance. Just be warned that after reading this book, you will probably go to bed an hour earlier every day.

Avoid caffeine later in the day and go to bed early enough so you wake up before your alarm rings. Most people need about 7-9 hours of sleep. Go to bed before midnight because the sleep quality you get is better than when you go to bed later. The night-owl programmer is just another cliche that belongs in the garbage can. And no, you don't actually think better at night, you just got used to this suboptimal schedule.

Many of us have the tendency to procrastinate when it's time to go to bed. That's a tricky problem. The thing that helped me solve it was setting up a daily schedule that clearly dictates my working hours and also when it's time for me to go to bed. In bed, I then read for 20-30 minutes because that makes me sleepy really fast. I also use a blue light blocker, like Flux, on both my computer and my phone, which is very effective in making me more sleepy towards the evening. Doing a short meditation, prayer, or stretching routine before bed, really anything that calms your mind can be very effective too. Again, you have to find out what works for you.


This post provided you with everything you need to know to get fit and in shape, even as a programmer who sits in front of the PC a lot and has job and family responsibilities.

Building muscle mass and doing regular cardio training is not only important for health and looks, it literally makes you smarter. And staying fit doesn't require a huge time investment—a few hours of training every week with the basic exercises I've shown you in this post are enough to cover all fronts and protect your body from deteriorating. Just make sure to also follow the dietary advice I've given you, first and foremost consuming the right amount of calories, which decides if you lose, gain, or maintain body weight.

I've also given you a few tricks and little hacks to make all of this easier, like intermittent fasting and the super-filling protein fluff recipe that I eat every day. Incorporate these tips into your daily routine, experiment a bit to find out what works best for you, be consistent and patient, and you will get the results.

See you in the gym 💪

Tip: I send regular high-quality web development content to my free email newsletter. It's a great way to improve your skills and stay ahead of the curve.

Subscribe Now

Check out these other posts: