From: Steve Litt Date: 2006-01-09T07:47:17+09:00 Subject: Re: Ideas on "Why Living Dangerous can be A Good Thing" in Ruby? On Sunday 08 January 2006 05:04 pm, Gregory Brown wrote: > On 1/8/06, Steve Litt wrote: > > That's why I'm glad my electric stove has > > lights saying which burners are still hot. And that's why I enjoy > > programming in languages like Ruby, Python and Java, that protect me from > > myself. > > Java: Yes. (in the average scenario) > Python: Pretty much kinda maybe. > Ruby: You'll shoot your eye out! ;) Everyone says that, but I don't see it (til it hits me in the eye? :-). Maybe I'm just used to C, where the slightest mistake leads to a subtle bug that happens every couple weeks. Sure, if I went out of my way I could make Ruby do corruptable things, whereas with C I cannot avoid it. Ruby has beautiful encapsulation. Yeah it could be defeated, but you'd really have to try. I want my language to protect me from my own mistakes, not from my own death wish. Personally, I'd NEVER gratuitously add a method or instance var to a class at runtime. If I needed more methods than the class provided, I'd subclass it. I mean, how hard is it to subclass something, especially in Ruby. Adding methods and instance variables to classes in real time reminds me of senators who add a social security amendment to a defense bill -- it's just bad business that can lead to no good. If someone can show me an advantage to adding methods and instance variables in real time, and that advantage can't be realized with normal OOP techniques, I'll keep an open mind. But unless it offers me a unique benefit that I need, I wouldn't do it. It's easy to use Ruby in a manner that respects encapsulation and a known state, and if used that way, I'll leave my goggles at home :-) SteveT Steve Litt http://www.troubleshooters.com slitt@troubleshooters.com