Behavior based programming added to playground.

http://www.arduino.cc/playground/Code/Behavior

Behaviors are one approach to abstracting and encapsulating control logic. That is, when your device should do one thing vs. another.

For example, an obstacle avoider may have behaviors to watch the front bumper, go forward, speed up if it hasn't hit anything for a while, or change direction when the front bumper is hit.

Behaviors are one way to make your programs easier to understand, by pulling bits of related code out of loop() and setup() and into a C++ class.