This paper starts with an introduction to the Onsager principle of minimum energy dissipation which governs the optimal paths of deviation and restoration to equilibrium. Then there is a review of the variational approach to moving contact line hydrodynamics. To demonstrate the validity of our continuum hydrodynamic model, numerical results from model calculations and molecular dynamics simulations are presented for immiscible Couette and Poiseuille flows past homogeneous solid surfaces, with remarkable overall agreement. Our continuum model is also used to study the contact line motion on surfaces patterned with stripes of different contact angles (i.e. surfaces of varying wettability). Continuum calculations predict the stick-slip motion for contact lines moving along these patterned surfaces, in quantitative agreement with molecular dynamics simulation results. This periodic motion is tunable through pattern period (geometry) and contrast in wetting property (chemistry). The consequence of stick-slip contact line motion on energy dissipation is discussed. © 2009 IOP Publishing Ltd.