Modelling the effects of heterogeneity on the mechanical response of solids