Ant colonies, and more generally social insect societies, are distributed systems that, in spite of the simplicity of their individuals, present a highly structured social organization. As a result of this organization, ant colonies can accomplish complex tasks that in some cases far exceed the individual capacities of a single ant. The study of ant colonies behavior and of their self-organizing capacities is interesting for computer scientists because it provides models of distributed organization which are useful to solve difficult optimization and distributed control problems. In this paper we overview some models derived from the observation of real ants, emphasizing the role played by stigmergy as distributed communication paradigm, and we show how these models have inspired a number of novel algorithms for the solution of distributed optimization and distributed control problems.