The role of shear dynamics in biofilm formation