I do all my work on a MacBook Pro and it is always connected to the power.
Is it ok to do this (from the battery view point)?
Should I empty it entirely periodically? if yes what is the preferred period?
A laptop that just sits on AC power all day and never on the battery will reduce how long it lasts. Give it some exercise by unplugging every now and then – Apple recommends giving it at least one charge cycle a month. So, unplug for a bit at least once a week and it should add up to one charge cycle a month. Remember, partial discharges are better than full.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I unplug frequently, and I've noticed that Battery Health Monitor seems to be mirroring what I am experiencing. When I first got my laptop, I would get around 3 hours unplugged. Now I get just a little over 2 hours, and Battery Health Monitor reports that my battery is around 75% of it's capacity fully charged. It will be interesting to keep track of this to see if, around a year from now, the battery gives out.
I think it's not a good idea to keep laptop plugged into power. A battery has a life (say 1000 charges) & if you charge it frequently it'll finish soon – although it’s not worth thinking about it. The idle way is to charge it when you need it (instead of continuously charging it) & remove it from charging if you don’t need it, IMO.
I've found that keeping my devices plugged in constantly seems to drag on the battery and make it run down faster. I often like to run my battery down at the end of the night by leaving the brightness at full blast, playing music, and/or just using safari and that seems to run it down pretty quickly so that when I put my device on the charger it charges all the way up. I've found that shutting down and restarting the device does help out the overall 'health' of the device as well.
What is recommended by apple for most all of their batteries, including Iphone and Ipads is that you should drain the battery to 20% or lower at least once every month and leave it untouched and charging from that point until it reaches 100% to retain its battery life for as long as possible. Although, I can't see a problem with the way you are working on your Macbook, simply because batteries lose their life based on how many cycles they've been through. If the MacBook is constantly charging, the battery isn't cycling, which means it is drawing power directly from the power source (the charge port) and not the battery itself.
I expect after 7 years the OP has probably got a decent handle on their battery life characteristics by now.
However, I heard recently about a study that suggests modern batteries like to be kept at around 65% charge for the most part of its life. The old idea of 'cycling' a battery, that is to drain it to zero and recharge, regularly is not as healthy as once thought. Perhaps it's more to do with new battery design rather than a past lack of understanding.