It basically depends on what's easiest and best for you on that particular build.
I tend to build all the major structural pieces before painting; essentially if there's going to be a visible seam I want it puttied and sanded before any paint goes on (I don't always get what I want). I prefer to paint the vertical surfaces first (bulkheads, vents, etc.) because I find it easier to mask them off as opposed to having to mask off the deck. I can wrap tape around a round vent, for example, but masking around that round vent on the deck is prone to octogons....
Build to keep the fragile stuff off as long as possible; don't put that tiny 20mm gun in before you've done all the work that could cause you to damage it accidentally. Working up and out as a general rule (put the central guns down before the outboard ones, so you don't have to reach over the outboard ones to reach the inner ones and risk accidentally pranging one with an errant finger.
Generally it's best to paint from lightest to darkest, but I find it easier to start with the hull and work my way up, even though the hull red and black boot topping are darker than haze gray. This is largely driven by the properties of tape. Even though I have to get a thicker coat of gray to cover the bot topping, the paint step it creates isn't really that visible because it's a step DOWN as most people view the model, so it's not as apparent.