OOP in Ruby?

Hi,

Anyone know of any good resources regarding OOP in Ruby?

Aidy

aidy wrote:

Hi,

Anyone know of any good resources regarding OOP in Ruby?

Err, about everything, I guess. :stuck_out_tongue_winking_eye:

~From personal experience: The PickAxe (Programming Ruby), and The Ruby
Way by Hal Fulton cover this nicely. And I suspect the O'Reilly book The
Ruby Programming Language (co-written by Matz) covers that in-depth, too.

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com

~ Is it a right to remain ignorant?
      -- Calvin

Can you be more specific?

···

On Thu, May 22, 2008 at 5:20 PM, aidy <aidy.lewis@googlemail.com> wrote:

Hi,

Anyone know of any good resources regarding OOP in Ruby?

Aidy

aidy wrote:

Hi,

Anyone know of any good resources regarding OOP in Ruby?

You might do well to first look for good OOP references, then see how they ideas are applied in Ruby.

Designing Object-Oriented Software by Rebecca Wirfs-Brock is quite good.

Be mindful that not everyone has the same idea of what it means to be OO; Ruby is largely message-oriented (unlike, say, Java's form of OO). (And not everyone who writes about OO in Ruby sees it that way. Caveat lector.)

···

--
James Britt

http://www.rubyaz.org - Hacking in the Desert
http://www.jamesbritt.com - Playing with Better Toys

Ruby is so object oriented that's it's almost impossible *not* to learn
about OOP by using it.

Books: Pickaxe is good; I'm halfway through reading it from cover to
cover (while also using it for reference). Another book I have is Ruby
Cookbook, by Carlson and Richardson, pub. by O'Reilly, which is next in
the queue for my bedtime reading.

I didn't know about the Matz book; that sounds well worth looking into.

Perhaps the OP is after a book on OOP illustrated by Ruby examples,
rather than the other way around?

···

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

I wrote a series of articles in which Smalltalk and Ruby OOP are
compared which, perhaps, you may find of some interest. Here are the
links:

http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-1
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-2-A
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-3-The-World

best wishes
Huw Collingbourne

SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com

···

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

I'm surprised that RPL (does it even have an abbreviation?) hasn't made a bigger splash. Or have I just missed it? About the only thing I've seen is a review by someone who didn't finish it. It seems like an O'Reilly book by Matz would be required reading for us all. And Flanagan is a good writer, though he and I have clashed technically.

I still have some of Pickaxe left, then I'm going to dive into RPL.

///ark

···

On May 22, 2008, at 9:29 AM, Phillip Gawlowski wrote:

I suspect the O'Reilly book The
Ruby Programming Language (co-written by Matz) covers [OOP] in-depth, too.

aidy wrote:
Anyone know of any good resources regarding OOP in Ruby?

Designing Object-Oriented Software by Rebecca Wirfs-Brock is quite good.

A classic indeed!

Be mindful that not everyone has the same idea of what it means to be OO;
Ruby is largely message-oriented (unlike, say, Java's form of OO). (And not
everyone who writes about OO in Ruby sees it that way. Caveat lector.)

Which is why Rebecca's book (actually Rebecca, Brian (Wilkerson), and
Lauren's (Wiener) book, is appropriate for Ruby.

This was one of the early books approaching OO design in the context
of Smalltalk, which introduced the computation by messages between
objects. It advocates a role-based approach rather than the
abstract-data type approach, corresponding to the C++ (and to a large
extent Java) view of OO.

···

On Thu, May 22, 2008 at 1:03 PM, James Britt <james.britt@gmail.com> wrote:

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

Using the late, lamented Dolphin Smalltalk. RIP. :frowning:

///ark

···

On May 25, 2008, at 9:57 AM, Huw Collingbourne wrote:

I wrote a series of articles in which Smalltalk and Ruby OOP are
compared which, perhaps, you may find of some interest. Here are the
links:

http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-1
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-2-A
http://www.sapphiresteel.com/Ruby-The-Smalltalk-Way-3-The-World

Pickaxe informs us about Ruby, but not OOA\D\P. Like Python and Java,
with Ruby you can still implement procedurally.

Aidy

···

On 22 May, 09:29, Phillip Gawlowski <cmdjackr...@googlemail.com> wrote:

> Hi,
>
> Anyone know of any good resources regarding OOP in Ruby?

Err, about everything, I guess. :stuck_out_tongue_winking_eye:

~From personal experience: The PickAxe (Programming Ruby), and The Ruby
Way by Hal Fulton cover this nicely. And I suspect the O'Reilly book The
Ruby Programming Language (co-written by Matz) covers that in-depth, too.

I feel that you could learn about OO Ruby, but the language does not
necessitate OO development. I could write everything in modules. I
could use classes as a container but not in an OO way (inheritance,
polymorphism and encapsulation).

Aidy

···

On 22 May, 10:03, Dave Bass <daveb...@musician.org> wrote:

Ruby is so object oriented that's it's almost impossible *not* to learn
about OOP by using it.

I can't cite any specific references, but I've heard a lot of good
things about it (and I own a copy as well). I get the impression it's
selling fairly well. To be fair, it's still a fairly new book and so
it's not quite as well-established as the PickAxe.

···

On Thu, May 22, 2008 at 11:48 AM, Mark Wilden <mark@mwilden.com> wrote:

I'm surprised that RPL (does it even have an abbreviation?) hasn't made a
bigger splash. Or have I just missed it?

If I were to take a guess, I'd say the RPL hasn't made such a splash because it's not really a "learn ruby" book, it's a "ruby reference" book.

I think it has the potential to be the Camel book or the K&R book, but it's in a tough position right now: the established ruby programmers that need a reference book have the Pickaxe already and the ruby newbies are looking for something a little more introductory.

Eventually people will start moving over to RPL.

To the best of my knowledge, RPL is your best source for ruby 1.9 information right now, which I'm sure will give it a leg up.

Just my 2¢,
-Dana

Mark Wilden wrote:

···

On May 22, 2008, at 9:29 AM, Phillip Gawlowski wrote:

I suspect the O'Reilly book The
Ruby Programming Language (co-written by Matz) covers [OOP] in-depth, too.

I'm surprised that RPL (does it even have an abbreviation?) hasn't made a bigger splash. Or have I just missed it? About the only thing I've seen is a review by someone who didn't finish it. It seems like an O'Reilly book by Matz would be required reading for us all. And Flanagan is a good writer, though he and I have clashed technically.

I still have some of Pickaxe left, then I'm going to dive into RPL.

///ark

--
Dana Merrick - System Administrator
Integrated Computer Solutions, Inc.
54B Middlesex Tpke, Bedford, MA 01730
617.621.0060 x112 - http://www.ics.com

Without wanting to start an indepth discussion about OO, but aren't these just two sides of the same medal? The message metaphor seems to lean a bit more on the client side while the ADT view is a bit more about how messages transform internal state (although ADT is mainly about observable state through sequences of method invocations). In the end, in both cases an instance holds state which is changed via method invocation / method sending and the implementation determines how the state may be manipulated.

Kind regards

  robert

···

On 22.05.2008 22:36, Rick DeNatale wrote:

This was one of the early books approaching OO design in the context
of Smalltalk, which introduced the computation by messages between
objects. It advocates a role-based approach rather than the
abstract-data type approach, corresponding to the C++ (and to a large
extent Java) view of OO.

Mark Wilden wrote:

Using the late, lamented Dolphin Smalltalk. RIP. :frowning:

It's not quite as dead as it seemed. At any rate, in August they
announced the end of development. Then in January, they announcded a new
beta: http://www.object-arts.com/content/news/x61beta1.html

I think Object Arts found it a struggle to make a living from Dolphin
Smalltalk which is why the developers were forced to take on other work.
But many existing Dolphin users were reluctant to let it go. Hence, its
'second life' (albeit, I suspect at a more laid-back rate of
development). It would be a great shame if Dolphin Smalltalk just faded
away. It's a lovely product.

best wishes
Huw

SapphireSteel Software
Ruby and Rails In Visual Studio
http://www.sapphiresteel.com

···

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

In Ruby, everything is an object.
First you must learn OOP (Object Orienter Programming), if you know oop
then Ruby's OOP.

Blog: Ruby Programming Language - http://ruby.unlimitedandfree.com

···

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

Lyle Johnson wrote:

···

On Thu, May 22, 2008 at 11:48 AM, Mark Wilden <mark@mwilden.com> wrote:

I'm surprised that RPL (does it even have an abbreviation?) hasn't made a
bigger splash. Or have I just missed it?

I can't cite any specific references, but I've heard a lot of good
things about it (and I own a copy as well). I get the impression it's
selling fairly well. To be fair, it's still a fairly new book and so
it's not quite as well-established as the PickAxe.

I also own a copy. I don't have it with me right now so I can't cite any
specific examples, but I've found it oddly incomplete. Sometimes I'll
look up something and not find it, and have to go to the Pickaxe
instead.

So, overall I think it's a good companion to the Pickaxe.
--
Posted via http://www.ruby-forum.com/\.

Actually, not wanting to toot my own horn too much, but... The new PickAxe beta is more up-to-date: Ruby 1.9 has changed significantly since December, and it continues to change. Hundreds of methods have been added to the built-in set. Complex and Rational are now built in. Existing methods have tweaks to their behavior. And changes are still being made. If you want a paper book now with 1.9 stuff in it, then RPL's the only game in town. I deliberately haven't looked at it because I don't want to taint what I'm writing for the PickAxe, but I hear good things.

If you're OK with a PDF that is getting updated as 1.9 evolves, then you might want the PickAxe.

Dave

···

On May 22, 2008, at 12:41 PM, Dana Merrick wrote:

To the best of my knowledge, RPL is your best source for ruby 1.9 information right now, which I'm sure will give it a leg up.

I wonder if most people are like you and me: bought it as soon as it came out, but haven't read it yet. :slight_smile:

///ark

···

On May 22, 2008, at 10:00 AM, Lyle Johnson wrote:

On Thu, May 22, 2008 at 11:48 AM, Mark Wilden <mark@mwilden.com> > wrote:

I'm surprised that RPL (does it even have an abbreviation?) hasn't made a
bigger splash. Or have I just missed it?

I can't cite any specific references, but I've heard a lot of good
things about it (and I own a copy as well). I get the impression it's
selling fairly well. To be fair, it's still a fairly new book and so
it's not quite as well-established as the PickAxe.

Robert Klemme wrote:

This was one of the early books approaching OO design in the context
of Smalltalk, which introduced the computation by messages between
objects. It advocates a role-based approach rather than the
abstract-data type approach, corresponding to the C++ (and to a large
extent Java) view of OO.

Without wanting to start an indepth discussion about OO, but aren't these just two sides of the same medal? The message metaphor seems to lean a bit more on the client side while the ADT view is a bit more about how messages transform internal state (although ADT is mainly about observable state through sequences of method invocations). In the end, in both cases an instance holds state which is changed via method invocation / method sending and the implementation determines how the state may be manipulated.

Here's the key difference to me: Taking a message-orient POV, you do not assume that messages == methods. You think in terms of how an object does things internally, and then how it will handle messages.

In Java the assumption is that any message you send has to map to a particular method. It does not encourage the same degree of encapsulation and emphasis on behavior being distinct from implementation.

In some ways it is similar to the difference in behavior-driven development and test-driven development.

Point of view matters.

···

On 22.05.2008 22:36, Rick DeNatale wrote:

--
James Britt

http://www.rubyaz.org - Hacking in the Desert
http://www.jamesbritt.com - Playing with Better Toys