On 2007-01-05 18:25:03 +0100, "gregarican" <greg.kujawa / gmail.com> said: > 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 thanks a lot for the link... I'll read taht tonight ! I have to understand how to avoid 'if.. ' and 'case..' to check mulitple 'submit buttons from my form... I have an account_controller object .. when the user 'submit the form, the 'confirm' method is called, but 2 buttons can confirm so I have to check upon the submit value... which I do each submit button CANNOT call a different method in my object.. ... I understand your concerns with OO programming approach, but who can illustrate this approach on such simple problem... joss