[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How Ruby

Dhushyanth Ramasamy

1/9/2009 6:18:00 AM

Well i read the posts on "Why ruby" now I wanted to know "How Ruby":


I recently chanced upon this forum while on internet. I too have
recently taken an interest in learning Ruby. The thing is I get sort of
overwhelmed when I see any of the forum pages( in ruby-central or any
other ruby forum). It's as if I haven't learned a thing. All the talk
say for example about testing, and about something called Merb made me
introspect(This site in particular since I want to participate in Google
summer of code or at least be capable of participating:
http://rubycentral.com/projects/gsoc-2008/ideas-for...) - Can I
really master this language? I feel that if I do learn a language I
should be able to do anything with it and not just write maze solving
programs, algorithmic problems, or some competition challenges.

Currently I have experience only in c++ coding( I have done a crash
course in Java though, but still feel that I am not expert enough) that
too only in an IDE (the kind of old stuff which they teach at our
school). I daresay I am best in my batch but I still feel I know nothing
when I go out and look into the big bad web. I mean for example, I am
still stuck to <iostream.h> whereas I found out that it is outdated and
changed to just simply <iostream> with use of std::namespace etc. I
still use arrays and don't know about vectors and hashes. So I would not
like to repeat my mistakes when I start anew with Ruby. I just want to
be at the leading edge along with the developers. I want to be at the
forefront and not just be a simple namesake programmer who knows nothing
about the "real world".
I would very much like to remedy this problem. This fear has raised
doubts in my head: Is programming really for me?, Will I always be a
noob?.....The thing is there isn't someone to teach you how to be an
expert. As I try to specialize in something, something comes up
which tells that you should know this before you go any further and so
forth. It's as if you need to know Java, XML, Ant, JUnit all at the same
time.
Can you suggest what I should do to remedy this? I really want to be an
expert in Ruby. Putting in the effort is no problem for me as long
as I know that I am going somewhere and am not just loitering
around.Currently I am studying Ruby through "Programming Ruby: the
pragmatic programmers guide, 2nd edition".


I do understand that people don't like long rambling posts but I needed
to get my feelings out of my system. This won't occur in future and
sorry for this awfully long post.
--
Posted via http://www.ruby-....

21 Answers

Mike Stephens

1/9/2009 7:35:00 AM

0

My view is you start out simple and straightforward. There are no Police
to arrest you if you write procedural Ruby programs. I have many Ruby
books and the impression I get is it is a complex, subtle and somewhat
arcane language. I have no intention of ever learning reflection and
that sort of thing. My long experience of IT tells me that code is a
tiny part of solving problems and that clever code is rarely preferable
to something simple and easy to understand. What I also want to avoid -
like you - is having to learn lots of things at once so my advice is
start off with raw Ruby out of the box, and only add layers as you
become comfortable with what you've already learnt. You're not in this
game to talk to clever people at conferences. You're here to build
systems that work.
--
Posted via http://www.ruby-....

Tom Cloyd

1/9/2009 12:02:00 PM

0

Thanks Mike. I appreciated your post. I'm an awful Ruby programmer, and
write tightly organized, well documented procedural Ruby. I'm only now,
after probably 1.5 years of on and off work in the language, getting
around to writing classes. I really couldn't see why I'd want to, until
very recently. Then, thanks to some folks on this list, I "got it". I
can't wait to dive in to using classes, now.

I'm also getting into cucumber and rspec as fast as I can (most
impressive, at least to me), and I've very grateful for the clever
people working in that corner of the universe. I'm learning an awful lot
from them.

I've loved the whole experience, even at my very humble level of
involvement. It's just been fun (well, not all the time). My programs
work, and they do work FOR me (my only client). I totally do NOT need
legitimization (not my profession), but it's still awfully nice to read
your post. You've described my attitude quite precisely.

t.

Mike Stephens wrote:
> My view is you start out simple and straightforward. There are no Police
> to arrest you if you write procedural Ruby programs. I have many Ruby
> books and the impression I get is it is a complex, subtle and somewhat
> arcane language. I have no intention of ever learning reflection and
> that sort of thing. My long experience of IT tells me that code is a
> tiny part of solving problems and that clever code is rarely preferable
> to something simple and easy to understand. What I also want to avoid -
> like you - is having to learn lots of things at once so my advice is
> start off with raw Ruby out of the box, and only add layers as you
> become comfortable with what you've already learnt. You're not in this
> game to talk to clever people at conferences. You're here to build
> systems that work.
>


--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


David A. Black

1/9/2009 1:25:00 PM

0

Hi --

On Fri, 9 Jan 2009, Mike Stephens wrote:

> My view is you start out simple and straightforward. There are no Police
> to arrest you if you write procedural Ruby programs. I have many Ruby
> books and the impression I get is it is a complex, subtle and somewhat
> arcane language. I have no intention of ever learning reflection and
> that sort of thing. My long experience of IT tells me that code is a
> tiny part of solving problems and that clever code is rarely preferable
> to something simple and easy to understand. What I also want to avoid -
> like you - is having to learn lots of things at once so my advice is
> start off with raw Ruby out of the box, and only add layers as you
> become comfortable with what you've already learnt. You're not in this
> game to talk to clever people at conferences. You're here to build
> systems that work.

At the same time, keep in mind that Ruby is optimized for programmer
enjoyment, so it in fact tries not to be arcane (though it's not
without a learning curve, of course). Also, things like reflection and
other so-called "metaprogramming" techniques in Ruby actually arise
very naturally from the basic object model and the basic idioms of the
language. It's all cut from the same cloth, which is one of the things
that make it fun and interesting.[1]

Lots of people who build systems that work also come to conferences,
where they enjoy the company and stimulation of their friends and
colleagues who have been working on other projects and have
interesting insights to share. I've co-organized around twenty
Ruby-related conferences, and attended quite a few others, and it's
been an on-going highlight of my experience as a Rubyist.

In short, I wouldn't look at either the Ruby language or the Ruby
world as a minefield of clever but shallow features and/or people. In
my 8+ years of experience with it, it's anything but.


David

[1]
http://dablog.rubypal.com/2007/1/7/meta-shmeta-learning-ruby-ho...

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!

David A. Black

1/9/2009 1:31:00 PM

0

Hi --

On Fri, 9 Jan 2009, Tom Cloyd wrote:

> Thanks Mike. I appreciated your post. I'm an awful Ruby programmer, and write
> tightly organized, well documented procedural Ruby. I'm only now, after
> probably 1.5 years of on and off work in the language, getting around to
> writing classes. I really couldn't see why I'd want to, until very recently.
> Then, thanks to some folks on this list, I "got it". I can't wait to dive in
> to using classes, now.

Dave Thomas issued a challenge in a recent keynote address, where he
suggested that when each of us writes our next Ruby program, we try to
do it without writing any classes. It's an artificial exercise, of
course, but it keeps the focus on the objects as opposed to the class
hierarchy, which is all to the good in most cases.

When I teach the Ruby language, I actually illustrate singleton
methods before I talk about classes, because I consider the dynamism
of objects (their independence from their classes) to be a more
important foundational principle of Ruby than the fact that every
object is an instance of a class. Mind you, like everyone else I write
"class Thing" more often than "def thing.something" in my own code (I
think :-) But it's still important, in my view, to get the hang of the
fact that Ruby classes are not the center of gravity.

So it sounds like you've done it in the right order :-) Keep modules
in mind, too. They're very cool, especially when you #extend objects
with them....


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!

Stuart Ellis

1/9/2009 2:26:00 PM

0


On 9 Jan 2009, at 13:30, David A. Black wrote:

> Hi --
>
> On Fri, 9 Jan 2009, Tom Cloyd wrote:
>
>> Thanks Mike. I appreciated your post. I'm an awful Ruby programmer,
>> and write tightly organized, well documented procedural Ruby. I'm
>> only now, after probably 1.5 years of on and off work in the
>> language, getting around to writing classes. I really couldn't see
>> why I'd want to, until very recently. Then, thanks to some folks on
>> this list, I "got it". I can't wait to dive in to using classes, now.
>
> Dave Thomas issued a challenge in a recent keynote address, where he
> suggested that when each of us writes our next Ruby program, we try to
> do it without writing any classes. It's an artificial exercise, of
> course, but it keeps the focus on the objects as opposed to the class
> hierarchy, which is all to the good in most cases.
>
> When I teach the Ruby language, I actually illustrate singleton
> methods before I talk about classes, because I consider the dynamism
> of objects (their independence from their classes) to be a more
> important foundational principle of Ruby than the fact that every
> object is an instance of a class. Mind you, like everyone else I write
> "class Thing" more often than "def thing.something" in my own code (I
> think :-) But it's still important, in my view, to get the hang of the
> fact that Ruby classes are not the center of gravity.
>
> So it sounds like you've done it in the right order :-) Keep modules
> in mind, too. They're very cool, especially when you #extend objects
> with them....

*Raises hand*

At the risk of looking very silly, could I ask you to say a bit more
about this? As a newbie, I have automatically read "object" to mean
"an instance of a defined class", and assumed that object orientation
in Ruby leads to mostly thinking in terms of classes.

Thank you,

--
Stuart Ellis
http://www.stua...


Mike Stephens

1/9/2009 2:37:00 PM

0


> In short, I wouldn't look at either the Ruby language or the Ruby
> world as a minefield of clever but shallow features and/or people.

I did not intend to suggest this. However coming from a background of
Pascal-like languages, Ruby strikes me as extremely powerful and
feature-rich, but correspondingly dangerous. The variable scope rules,
for example, do seem to be conceived by someone with a sadistic turn of
mind. Matz might see it as a medium of natural expression but maybe not
everyone has his IQ.
--
Posted via http://www.ruby-....

LAMBEAU Bernard

1/9/2009 3:23:00 PM

0

Ruby allows you to install methods on objects (called singleton
methods because installed on individual objects instead of being
shared by all instances of a class):

o = Object.new
def o.sayhello
puts "hello"
end

o.sayhello # prints hello to the console

blambeau

On Fri, Jan 9, 2009 at 3:25 PM, Stuart Ellis <stuart@stuartellis.eu> wrote:
>
> On 9 Jan 2009, at 13:30, David A. Black wrote:
>
>> Hi --
>>
>> On Fri, 9 Jan 2009, Tom Cloyd wrote:
>>
>>> Thanks Mike. I appreciated your post. I'm an awful Ruby programmer, and
>>> write tightly organized, well documented procedural Ruby. I'm only now,
>>> after probably 1.5 years of on and off work in the language, getting around
>>> to writing classes. I really couldn't see why I'd want to, until very
>>> recently. Then, thanks to some folks on this list, I "got it". I can't wait
>>> to dive in to using classes, now.
>>
>> Dave Thomas issued a challenge in a recent keynote address, where he
>> suggested that when each of us writes our next Ruby program, we try to
>> do it without writing any classes. It's an artificial exercise, of
>> course, but it keeps the focus on the objects as opposed to the class
>> hierarchy, which is all to the good in most cases.
>>
>> When I teach the Ruby language, I actually illustrate singleton
>> methods before I talk about classes, because I consider the dynamism
>> of objects (their independence from their classes) to be a more
>> important foundational principle of Ruby than the fact that every
>> object is an instance of a class. Mind you, like everyone else I write
>> "class Thing" more often than "def thing.something" in my own code (I
>> think :-) But it's still important, in my view, to get the hang of the
>> fact that Ruby classes are not the center of gravity.
>>
>> So it sounds like you've done it in the right order :-) Keep modules
>> in mind, too. They're very cool, especially when you #extend objects
>> with them....
>
> *Raises hand*
>
> At the risk of looking very silly, could I ask you to say a bit more about
> this? As a newbie, I have automatically read "object" to mean "an instance
> of a defined class", and assumed that object orientation in Ruby leads to
> mostly thinking in terms of classes.
>
> Thank you,
>
> --
> Stuart Ellis
> http://www.stua...
>
>
>

Dhushyanth Ramasamy

1/9/2009 3:24:00 PM

0

Mike Stephens wrote:
> My view is you start ........ You're not in this
> game to talk to clever people at conferences. You're here to build
> systems that work.

I think we are getting side-tracked here I wanted to know "how Ruby" not
"why Ruby". So apart from Mike's i daresay other replies were
distractions( no offence guys, but i think they are part of the "Why
Ruby" or completely separate discussions).
I wanted to know a concrete study plan or a general "road to utopia"
guidance.

Thanks by the way all of you guys for your active interest. This forum
roxxxx..
--
Posted via http://www.ruby-....

Stuart Ellis

1/10/2009 11:09:00 AM

0


On 9 Jan 2009, at 15:22, LAMBEAU Bernard wrote:

> Ruby allows you to install methods on objects (called singleton
> methods because installed on individual objects instead of being
> shared by all instances of a class):
>
> o = Object.new
> def o.sayhello
> puts "hello"
> end
>
> o.sayhello # prints hello to the console
>
> blambeau
>

Now I see - thanks.

--
Stuart Ellis
http://www.stua...


David A. Black

1/10/2009 2:46:00 PM

0

Hi --

On Sat, 10 Jan 2009, Stuart Ellis wrote:

>
> On 9 Jan 2009, at 15:22, LAMBEAU Bernard wrote:
>
>> Ruby allows you to install methods on objects (called singleton
>> methods because installed on individual objects instead of being
>> shared by all instances of a class):
>>
>> o = Object.new
>> def o.sayhello
>> puts "hello"
>> end
>>
>> o.sayhello # prints hello to the console
>>
>> blambeau
>>
>
> Now I see - thanks.

Also, you can use modules to shape the behavior of individual objects:

module Vocal
def sayhello
puts "Hello"
end
end

o = Object.new
o.extend(Vocal)
o.sayhello


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!