Traits are more like mixins which allow us to achieve horizontal code reuse. This allows us to respect the DRY principle while allowing combinations of functionality easily. Imagine trying to build classes from permutations of BouncingBall, ColoredBall, FlyingBall and RollingBall. Or adding a persist method to User and Book without duplicating code.
A quick google of horizontal inheritance will give you loads of examples.
Stefan Jibrail Froelich - 2011-08-06 19:23:33 - In reply to message 1 from Stefan Jibrail Froelich
'...it seems to be similar to inheritance, multiple inheritance, in a different way...'.
I wanted to point out that though it might seem that way, it shouldnt be confused with vertical inheritance.
Believe me, many of us follow this cast (i cant wait for the next one) and your words are like gold to us. Some newbie might take it as is. Thanks for the best repository by the way.