You generally never max W first or second because it's the only ability of her 4 that doesn't scale downward in CD by level. I can give a rough guess as the scenarios you're asking about.
If you're having a rough time in lane, or you're in a situation where you aren't able to actually get much of your Q rotation off in terms of damage, then maxing W->E instead could hypothetically be better since W gives more upfront damage that a single Q's worth, and E second to soak up damage and retreat more often. You'll generally always get your W off even if not every Q due to it being used towards the middle of the combination. A lot of Riven's damage when fighting with Q actually comes from auto weaving using her passive stacks which aren't tied to how many points are in your Q or W.
If you're able to successfully draw out your Q's potential power and are maxing it first, then you'd go ahead and max E second for the shorter duration and more damage absorbed. W second would only give so much more damage, whereas with Q-E OR W->E you're retaining some defensive ability alongside your offensive or vice versa if E->Q or E->W. You'd never max double offensive Q->W or W->Q because of the vulnerability from not maxing E at least second.
tl;dr W over Q is better in instances where you can't really get much damage from Q (high CC or extended trade winners I guess). E after Q for offensive/defensive balance (clear up weak points)