The structure theorem of Hadamard-Zolésio states that the derivative of a shape functional is a distribution on the boundary of the domain depending only on the normal perturbations of a smooth enough boundary. Actually the domain representation, also known as distributed shape derivative, is more general than the boundary expression as it is well-defined for shapes having a lower regularity. It is customary in the shape optimization literature to assume regularity of the domains and use the boundary expression of the shape derivative for numerical algorithms. In this paper we describe several advantages of the distributed shape derivative in terms of generality, easiness of computation and numerical implementation. We identify a tensor representation of the distributed shape derivative, study its properties and show how it allows to recover the boundary expression directly. We use a novel Lagrangian approach, which is applicable to a large class of shape optimization problems, to compute the distributed shape derivative. We also apply the technique to retrieve the distributed shape derivative for electrical impedance tomography. Finally we explain how to adapt the level set method to the distributed shape derivative framework and present numerical results.