On 08 Dec 2004, at 13:12, Nicholas Van Weerdenburg wrote: > Immutability also speaks to this- it's an interface contract that says > "read-only", limiting side effects. Having experienced the beauty of > making objects immutable and watching the exceptions flare was a > epiphany for me in Java development. I've used unit tests for this more that immutability. Your same euphoric state can be had with a solid, comprehensive set of unit tests. (Not to say that immutability can't help.) In ParseTree/Ruby2C we've over 350 tests and 500 assertions, and any changes to our interfaces are immediately recognizable by cascades of failing tests. > The forced restructuring of the > code was excellent- reduced coupling and increased cohesion. So, as a > design pressure, it was very positive. You can get the same benefit from unit tests. > Of course, a good design would > have avoided the need, but that's like saying well written code > doesn't need tests. It was a useful design pressure that achieved good > goals. I haven't seen anything in Ruby that makes me think that it > might not be a good design pressure in Ruby to enforce low coupling > and high cohesion. The less coupled my code is, the easier writing unit tests becomes for me.