From: gregarican Date: 2007-01-06T02:30:05+09:00 Subject: Re: case when... Good point. All of it makes for good mental exercise and ultimately more effective and efficient development. Rather than run something through a bunch of conditionals, just pass along an overridden message like 'processYourself' and let the object do the work. Depending on what the object is receiving the message it can choose its own way of doing things. James Edward Gray II wrote: > On Jan 5, 2007, at 11:10 AM, gregarican wrote: > > > Personally I like to adopt the old Smalltalk philosophy, where they > > don't even use case statements. Since over time these can grow long > > and > > ungainly you can take a different programming approach. It's a bit > > of a > > mind stretch depending on where you're coming from, but it is good > > practice. I think there's an older book called Smalltalk Best Practice > > Patterns that touches on this. > > It's also a "code smell" according to the classic Refactoring text: > > http://www.refactoring.com/catalog/ > replaceConditionalWithPolymorphism.html > > James Edward Gray II