Certain barrel lengths were recommended for certain disciplines usually because shorter lighter barrels meant faster gun movement (say skeet) and heavy, longer barrels more controlled gun movement over a shorter distance (say DTL). Personal preference could overrule any such recommendation and trap shooters often used their trap guns for sporting – if you can handle longer barrels then more control is helpful.
Now with balancing systems etc barrel weight is much less objectively important and the barrel length becomes very much a personal choice. Also, barrels can be lighter so we get a movement towards 32 inch – see the 682 Gold E where the 32 inch Optima barrels were lighter that the 30 ¾ inch 682 Gold (Mobil) barrels they replaced.
Much comes down to the shooter. Most on day one of their shooting journey will pick the lighter gun with shorter barrels and love it. As time goes on – sometimes a short time - gun weight increases and longer barrels are wanted – maybe for the sight picture though personally a tramline seem better to me if optically you need a longer sight plane. Muscles build and the gun becomes comparatively lighter. Those who have been shooting a while recommend longer barrels and understandably so.
I would agree with those who suggest you pick a gun you like with a few exceptions.
For ESP you will quickly grow out of a gun with light barrels.
If you are unsure don’t spend silly money. Most of the high end gun have longer barrels and that’s because ‘high end’ shooters want them and that's for a reason.
30 inch is usually a good mid ground – you can pop in some long extended chokes to add weight as you learn more about what you want.
Get one with a good balance point. You can add weight to the stock but quite a lot is needed if the barrels are heavy – I had a (30 inch) Miroku 7000 which required 100g in the stock to get it anything like over the hinge point.
You will, over time prefer a heavier gun which means 31 or 32 inch maybe the long term way forward.
The fourth point is key in my opinion and ultimately a well balanced gun is always good to shoot whatever the weight.