Alleviate the health problems of sitting all-day

Pierre Haller
Pierre HallerDecember 09, 2020
#js

Sitting for long periods every day can have serious consequences for your health.

Actually, sitting:

As developers, we should be aware of these risks. Most of us are sitting more than 8 hours a day, even more during these times of lockdown!

But thankfully you can counter these effects pretty easily.

TL;DR

We have established 5 minutes of stretching once every hour at Marmelab.

We developed a Discord bot to remind us to stretch every hour. It's available on GitHub: marmelab/stretch-discord

What We Can Do To Avoid Injuries

There are multiples ways to minimize theses health consequences:

  • Don't sit in the same position for too long. You should switch your posture every 30 minutes. No single posture is good for a long period!
  • Use a standing desk: it allows you to continue working while standing up - but it can be costly.
  • Take a short break from sitting once an hour: it seems to alleviate most of the problems of the sitting position.
  • Stretch out: it boosts flexibility, and it's within the reach of everyone.

In Marmelab's office, we have an adaptable standing desk but it's rarely used by anyone because we have to move our stuff to use it. A solution would be to have one standing desk for each developer but it has a cost, and it's not sure we would use it frequently. Moreover, currently, everyone is working from home.

So we opted for a mix of the two lasts solutions: we take a break every hour to stretch! For that, we have a Discord channel named health where everyone who wants to stretch can meet. This has multiples benefits :

  • It alleviates the effects of sitting.
  • It sticks out our heads from code for a moment.
  • It allows us to socialize in a time when we're alone with our computers.

And to help us to do the right exercises in the correct way, we have Gildas, who endorsed the role of stretching coach!

A Friendly Reminder

On occasions, everyone had the head to the grindstone, and we missed some stretching sessions. And when Gildas was on holiday, we would only do the stretches we remembered.

To avoid forgetting about stretching, we developed a Discord bot that sends us an exercise every hour on our health channel.

For that we used :

And it appears that developing a Discord bot is really easy. There is a lot of documentation and tutorials about it out there so I won't get into details. Actually, the hard part was to build a stretching exercise database! But thankfully there is a lot of resources out there, too.

The bot is quite simple. Once invited to a Discord server, it will listen to all the channels. If the command !stretch is sent, it will send a stretch exercise scheduled from a CRON. It works too if you send the command directly to the bot by private message.

Here is how we send the stretch exercise to the subscribed channels:

const sendRandomStretch = () => {
    const channels = await getChannels();
    const { title, image, url, body } = getRandomStretch();
    const formatedBody = body.map((value, index) => ({
        name: `Step ${index + 1}`,
        value,
    }));
    const message = new Discord.MessageEmbed()
        .setTitle(title)
        .setImage(image)
        .addFields(...formatedBody)
        .setURL(url);

    channels.forEach((channel) =>
        channel.send({
            embed: message,
            content: "It's stretching time!",
        })
    );
}

Here is the result: Discord bot example

You can see the code here: marmelab/stretch-discord. Actually, you can use it for every sort of reminder on discord with little to no changes. Feel free to fork it!

Conclusion

After several months of usage of this bot, almost half of the Marmelab team meet up every hour to stretch in our health channel! Even when Gildas is on holiday we have well-documented stretching exercises to do. This allowed us to stay active during the lockdowns and to keep in touch with each other.

Did you like this article? Share it!