The theory of the linear optical response of excitons in quantum wells and polaritons in planar semiconductor microcavities is reviewed, in the light of the existing experiments. For quantum well excitons, it is shown that disorder mainly affects the exciton centre-of-mass motion and is modelled by an effective Schrodinger equation in two dimensions. For polaritons, a unified model accounting for quantum well roughness and fluctuations of the microcavity thickness is developed. Numerical results confirm that polaritons are mostly affected by disorder acting on the photon component, thus confirming existing studies on the influence of exciton disorder. The polariton localization length is estimated to be in the few-micrometres range, depending on the amplitude of disorder, in agreement with recent experimental findings.