We give a general treatment of deformation theory from the point of view of homotopical algebra following Hinich, Manetti and Pridham. In particular, we show that any deformation functor in characteristic zero is controlled by a certain differential graded Lie algebra defined up to homotopy, and also formulate a noncommutative analogue of this result valid in any characteristic.