Defending Ruby's OOP

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

···

--
Posted via http://www.ruby-forum.com/.

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

Righteously! Ye must purge yon heretics with whips and scorpions!

(Alternatively, why bother?)

···

--
Giles Bowkett

I'm running a time management experiment: I'm only checking e-mail
twice per day, at 11am and 5pm. If you need to get in touch quicker
than that, call me on my cell.

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org

Argue with smarter people.

-s

···

In message <1729121287c950a23813c5596b4b3f57@ruby-forum.com>, Lucas Holland writes:

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

Tell him to find a more substantial argument. That's the lamest complaint I
think I've ever heard about Ruby or dynamic languages in general.

Or better yet, tell him to design a language that has "if" "unless" etc as
objects and see where that goes. What does having if/unless as objects even
mean?

Jason

···

On 5/10/07, Lucas Holland <hollandlucas@gmail.com> wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

--
Posted via http://www.ruby-forum.com/\.

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

You don't need to defend yourself. Tell your friend he hasn't understood OOP
yet.
OO does not mean you need to programming everything with method calls but
containing certain aspects in objects. It's about software design and not
control logic.

Kind regards
Nicolai

Just redefine the meaning of 100%, that should work.
If not, redefine the meaning of OOP.

Really, it seems like a silly argument. Better to
simply understand what Ruby is or isn't and the same
for other languages. I doubt that there is some
mathematically-true total ordering on programming
languages relative to OOPness (or any other criteria
for that matter).

Gary Wright

···

On May 10, 2007, at 3:26 PM, Lucas Holland wrote:

How can I defend the claim that Ruby is 100% OOP?

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

Well, as others have said, it's a stupid thing to argue about.

But to answer your actual question, your friend is correct. for, case,
do, else, if, etc. are reserved words, not objects. Check your pickaxe
book, page 329.

-Dan Debertin
debertin@gmail.com

···

From: Lucas Holland <hollandlucas@gmail.com>

Hi Lucas,

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

Do you have to?

There are a lot of languages claiming to be pure OO languages, but are they really? What is a pure OO language at all?

Some say Java is OO, but is it? I don't think so. Java is OO in a sense but lacks a lot of features that would make is "purely" OO.

A pure OO implementation of a language would have to have the capacity to model anything in life. That is we would not have only objects (or classes) but would also need some kind of verb construct that we would be able to model. Or how do you model a class for let's say a while statement? This would be a verb that you could model somehow...

verb While
   def condition_met?
     #bla bla bla
   end
end

The real question here is if it makes sense at all. I think that the work done so far in OO is much more impressive than this. Instead of trying to focus on the pureness of a language regarding it's OO-ness we should focus on how good can I model the Domain Model (i.e. the problem) at hand and how good does it help me to solve that problem.

Coming from a Java environment I can remember the times when we used JDBC (back in the late 90's) coding our access to the database, transactions, two-phase-commits. Then Hibernate appeared down the road and made life easier. And in Ruby...

Well, if you have ever coded a database access in Java (or C, or any compiled language y guess) and then see the power of ActiveRecord (and of Ruby in this case), how it dynamically gives you methods to a class that did not have them before... That is impressive!

It not only helps you to work faster and having more fun (something i really appreciate, I remember a few months ago, when I started working with Ruby I changed a middleware server my company did in Java for the last one and a half years in one day using Ruby), it gives you those tools (idiomatic) to model much better the domain at hand.

And that is something to consider. Does this language help me to get the job done? Or if you are talking to your boss... Than make a simple calculus:

1,5 years coding in Java = hundreds of thousands of euros
1 day coding in Ruby = lots of fun

Cheers,

Enrique Comba Riepenhausen

···

On 10 May 2007, at 21:26, Lucas Holland wrote:

Lucas Holland wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

Yeah, it is just silly. If he has his own definition of 100% OOP, why
not make each character am object? What about font size? I agree with
the earlier post, argue with smarter people.

···

--
Posted via http://www.ruby-forum.com/\.

Remind him that Ruby is, of course, superior to all other languages because it is red.

···

On May 10, 2007, at 3:26 PM, Lucas Holland wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

--
Posted via http://www.ruby-forum.com/\.

Peter Booth
peter_booth@mac.com
917 445 5663

Lucas Holland wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

I have to wonder what exactly the benefit of having control structures
as objects would be? The bottom line effectiveness of any language
relates to what one can accomplish with it and how efficiently said task
can be accomplished. Under what circumstance would overriding the "if"
method be beneficial? Not to mention the fact that since Ruby provides
the ability to override things like operators and more functional
components (that can be more logically represented as objects), then why
would the lack of control structure object orientation make Ruby less of
an OO language? Not to mention the kind of trouble that one could easily
get into attempting to override control structures.

···

--
Posted via http://www.ruby-forum.com/\.

In message <e078f4ba0705101239t3795cb9bo76cf2e75b464ddf0@mail.gmail.com>, "Jason Roelofs" write
s:

Or better yet, tell him to design a language that has "if" "unless" etc as
objects and see where that goes. What does having if/unless as objects even
mean?

Doesn't Tcl essentially do that?

If he really wants a language in which everything is an object, give him
a lollipop. (With apologies to Alan Perlis.)

-s

In Smalltalk, if-then-else is a message and messages are objects....

If Ruby is 100% OOP, then what is Smalltalk?

Gary Wright

···

On May 10, 2007, at 3:39 PM, Jason Roelofs wrote:

Or better yet, tell him to design a language that has "if" "unless" etc as
objects and see where that goes. What does having if/unless as objects even
mean?

Tell him to find a more substantial argument. That's the lamest complaint I
think I've ever heard about Ruby or dynamic languages in general.

Or better yet, tell him to design a language that has "if" "unless" etc as
objects and see where that goes. What does having if/unless as objects even
mean?

It's like saying the car is inferior to the horse because you can't
feed the car oats.

Smalltalk is the purest OOP language there is and it doesn't **have**
if or unless at all. You know how you can bypass control structures in
Ruby by using blocks and closures instead? In Smalltalk, that's the
only way to do control structures at all. "If" and "unless" don't even
exist in Smalltalk. "If" and "unless" are not fundamental in the first
place. They're a conscious design feature. It sounds like the person
you're arguing with is a Smalltalk stalwart and/or an argumentative
type making a silly, meaningless point which is only useful for the
sake of arguing.

Seriously, what kind of object would an If object be? What is the
essence of If-ness? I think if anybody could answer that question they
would instantly achieve enlightment and then their head would explode.

···

--
Giles Bowkett

I'm running a time management experiment: I'm only checking e-mail
twice per day, at 11am and 5pm. If you need to get in touch quicker
than that, call me on my cell.

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org

Well, as others have said, it's a stupid thing to argue about.

I think getting into that kind of argument at all is a bad idea.

You're only defending a language's design decisions when engaged in
ideological arguments. That kind of argument is bad for the community,
because it encourages picking sides, and bad for the language itself,
insofar as it influences design decisions. Design decisions are not
about taking a side ideologically. They're about building something
useful.

Don't even bother defending Ruby in any context, except against the
charge that it is not **useful** for some purpose, and then only if it
really **is** useful for that purpose.

···

--
Giles Bowkett

I'm running a time management experiment: I'm only checking e-mail
twice per day, at 11am and 5pm. If you need to get in touch quicker
than that, call me on my cell.

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org

the_if = if.new
the_then = then.new
then_end = end.new
the_else = else.new

the_if(1==2) the_then
   the_else()
the_end

Yeah... I can't make sense of it either.

Jason Roelofs wrote, On 5/10/2007 2:39 PM:

···

Tell him to find a more substantial argument. That's the lamest complaint I
think I've ever heard about Ruby or dynamic languages in general.

Or better yet, tell him to design a language that has "if" "unless" etc as
objects and see where that goes. What does having if/unless as objects even
mean?

Jason

On 5/10/07, Lucas Holland <hollandlucas@gmail.com> wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

--
Posted via http://www.ruby-forum.com/\.

Gary Wright wrote, On 5/10/2007 2:47 PM:

How can I defend the claim that Ruby is 100% OOP?

Just redefine the meaning of 100%, that should work.
If not, redefine the meaning of OOP.

Really, it seems like a silly argument. Better to
simply understand what Ruby is or isn't and the same
for other languages. I doubt that there is some
mathematically-true total ordering on programming
languages relative to OOPness (or any other criteria
for that matter).

And more importantly, what value would that bring?

···

On May 10, 2007, at 3:26 PM, Lucas Holland wrote:

# Or better yet, tell him to design a language that has "if"
# "unless" etc as objects and see where that goes. What does having
# if/unless as objects even mean?

Maybe they mean a boolean class. I myself would like a boolean class in ruby. Sometimes, i feel if-else constructs too restrictive,.. maybe i hate grammar rules.. (maybe because i find english weird language??)

anyway, can we chain booleans like this?

(x<2).iftrue{"got it!"}.capitalize.each{|c| puts c}
=>G
  o
  t
  
  i
  t
  !

···

From: Jason Roelofs [mailto:jameskilton@gmail.com] :

Blocks are not objects, either, until they are encapsulated into a Proc
object. Methods are also not objects, until they are encapsulated into
a Method object.

Making everything an object makes the language more consistent, but IMO
less natural. In fact, I think OOP isn't very natural, but is beautiful
once you learn it.

Paul

···

On Fri, May 11, 2007 at 04:53:06AM +0900, Dan Debertin wrote:

But to answer your actual question, your friend is correct. for, case,
do, else, if, etc. are reserved words, not objects. Check your pickaxe
book, page 329.

Hmm... there could be some bizarre and interesting possibilities.
For example, instead of if,
why not a construct called 'perhaps' or 'maybe' to include randomness or other interesting side-effects.
Or even 'occasionally' or 'usually' for weighted randomness.
Adverbs could make very interesting control structures, which could of course be def'd more (or less) precisely.
Imagine the expressive possibilities of: often, quickly, slowly, monthly, quarterly, hourly, randomly, quietly, obsequiously, obscenely, derisively, politely, privately, publicly, etc...
'unless' could be 'other_than' or 'except_if'
'if' itself could be semantically described as the same as 'when' in many human languages.
Rather than simply being declarative like java keywords, many constructs could become more descriptive.
This is one of Ruby's biggest strengths, its expressiveness in a very natural way.

Once it has got the native unicode thing happening, it will be possible to begin to write Ruby in languages other than English!
Even in Japanese (which would by its grammar, make a very good programming language)

Some abstraction is bad because it continues to slow things down, but processing power is still increasing, while human limits are pretty constant.

···

On May 15, 2007, at 4:55 AM, Mike Hamilton wrote:

Lucas Holland wrote:

Hi,

I've got someone here saying that Ruby (and other languages) can't be
100% object-oriented because if and unless and so on (keywords) are no
objects.

How can I defend the claim that Ruby is 100% OOP?

I have to wonder what exactly the benefit of having control structures
as objects would be? The bottom line effectiveness of any language
relates to what one can accomplish with it and how efficiently said task
can be accomplished. Under what circumstance would overriding the "if"
method be beneficial? Not to mention the fact that since Ruby provides
the ability to override things like operators and more functional
components (that can be more logically represented as objects), then why
would the lack of control structure object orientation make Ruby less of
an OO language? Not to mention the kind of trouble that one could easily
get into attempting to override control structures.

--
Posted via http://www.ruby-forum.com/\.