By defining the characteristics (movement, attraction, gravity etc) of the elements you can set up the initial rules for behaviors which mimic observable behaviors such as flocking. These elements often take on a life of their own as they interact in ways which you could not have foreseen.
http://processing.org/