Quote:Original post by Way Walker
Maybe a little relevant. The other day I was reading an intro book on Ruby. At one point, it made a big deal of how Ruby was object oriented and how instead of doing Math.abs(someFloat) like you would in Java you do someFloat.abs because Float is a class and knows how to do nifty things like that. Ok, cool. Now, I wanted to calculate the distance between two points. someFloat.sqrt -> Error. Nope, you do Math.sqrt(someFloat). [headshake]
<continuing-tangent> Gotta love the little things like that, eh?
A powerful (if easily abused) feature of Ruby is it's open-ness of classes however:
irb(main):001:0> class Floatirb(main):002:1> def sqrt()irb(main):003:2> Math.sqrt(self)irb(main):004:2> endirb(main):005:1> end=> nilirb(main):006:0> 9.0.sqrt=> 3.0irb(main):007:0> _
Clarification on earlier points:
When I argue against Object Obsessed Programming, I argue against forcing the programmer to deal with everything from within the OOP paradigm. Everything can be an object as long as the programmer isn't forced to be aware of it.