When the discrete graphics chip is being used, plus a retina display, and or several dongles plugged in for ethernet, usb-a or whatever, battery life on my 2017 MBP while doing development work is maybe 3-4 hours.
It was quite a shock to go to that from the 8-9 hours I used to get from my older MacBook air. Whereas previously I would leave certain apps (notably image editing apps or VMs) open while developing, I now find myself opening them, doing a task and then closing them so as not to activate the discrete graphics chip and drain the battery.