From: Pistos Christou Date: 2006-05-08T04:16:59+09:00 Subject: Re: Extending Core Classes - Best Practices Lou Scoras wrote: > I agree with you that you would probably be safe in 99.8% of cases, > but sometimes you are better off safe than sorry. Ruby is flexible > enough to let you go either way, and that's a good thing. If you are > confident go for it and modify the class; if not code more > defensively. Hm, okay. I think I'll keep living a bit dangerously in this regard, then. :) I would tread much more carefully, though, if I were naming things that people might possibly use or assume in other places. > Perhaps another thing to consider is on a more logical level. If the > method is not something that *any string* should be able to do, you've > probably put it into the wrong class. Well, if I'm interested if a string is #vogon? or not, I can't see why I would try to segregate strings into two groups. The only other alternative that comes to mind is writing un-OO stuff like: class SomeApplication def is_vogon?( str ) VOGON_REGEXP === str end end Which just feels unRubylike to me. > Good luck either way you decide, and write lots of tests =) Thanks. Your input has been helpful, and I appreciate you taking the time to share it. Pistos -- Posted via http://www.ruby-forum.com/.