[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

I need to learn...

Robert H

3/12/2007 1:33:00 AM

I would like to learn Ruby so I am looking at getting "Programming
Ruby". I am also looking at converting stuff to RoR, so I was looking
at getting "Agile Web Development with Rails".

Would those be good?

Robert

36 Answers

Harry

3/12/2007 2:02:00 AM

0

On 3/12/07, Robert Hicks <sigzero@gmail.com> wrote:
> I would like to learn Ruby so I am looking at getting "Programming
> Ruby". I am also looking at converting stuff to RoR, so I was looking
> at getting "Agile Web Development with Rails".
>
> Would those be good?
>
> Robert
>

Hi,

Programming Ruby is good.
You can see the 1st edition online.

http://www.rubycentral...

I haven't read "Agile Web Development with Rails" yet.

Harry
--

http://www.kakueki.com/ruby...
Japanese Ruby List Subjects in English

Marc Heiler

3/12/2007 2:07:00 AM

0

I have both. My personal opinion, and I am biased, is that
the ruby book is very good. I (still) often use it for reference.

The Rails book well ... I think a disadvantage _is_ that it is
very speficic to rails. I often saw people asking ruby
questions, which lead me to the FIRM opinion, that everyone that
really wants to use rails, needs to learn ruby too. (Doesnt
have to learn _everything_ but must understand basic stuff,
such as :symbols, hashes arrays AND be able to use
them. Oh and of course, irb too... on IRC it happens too often
that people on rails dont know irb, and it can
be frustrating to tutor people that are only, mostly interested
in rails)


Anyway to your questions, Programming Ruby is definitely worth it.

And the RoR book probably only when you need to use RoR too ;)

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

Mark K. Bilbo

3/12/2007 2:40:00 AM

0

On Sun, 11 Mar 2007 19:32:34 -0700, Robert Hicks wrote:

> I would like to learn Ruby so I am looking at getting "Programming
> Ruby". I am also looking at converting stuff to RoR, so I was looking
> at getting "Agile Web Development with Rails".
>
> Would those be good?

I'm still pretty new to Ruby myself and found the Rails book, well,
confusing. Rails is a framework built with Ruby and the book isn't aimed
at helping you with Ruby itself.

The first edition (not the second edition which covers 1.8) of
"Programming Ruby - The Pragmatic Programmer's Guide" is online:

http://www.ruby-doc.org/docs/Progra...

So you could take a look before you buy a copy (of the second edition) to
see what you think.

And look around ruby-doc.org, there's some very useful info there.

--
Mark K. Bilbo
------------------------------------------------------------
"Come to think of it, there are already a million monkeys
on a million typewriters, and the Usenet is NOTHING
like Shakespeare!" - Blair Houghton

7stud 7stud

3/12/2007 5:35:00 AM

0

Marc Heiler wrote:
> on IRC it happens too often
> that people on rails dont know irb, and it can
> be frustrating to tutor people that are only, mostly interested
> in rails)
>

I don't understand the distinction between "learning irb" and "learning
Ruby". For instance, if I am going to write a hello world program, I
open up a text editor, type in the code, save it, and then run it by
typing:

ruby myProgram.rb

I realize that you could do the same thing in irb, but editing is easier
in a text file. So, as far as I can tell, you don't ever have to use
irb to learn Ruby. Is there something important about irb that I am
missing?

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

Morton Goldberg

3/12/2007 7:33:00 AM

0


On Mar 12, 2007, at 1:34 AM, 7stud 7stud wrote:

> Marc Heiler wrote:
>> on IRC it happens too often
>> that people on rails dont know irb, and it can
>> be frustrating to tutor people that are only, mostly interested
>> in rails)
>>
>
> I don't understand the distinction between "learning irb" and
> "learning
> Ruby". For instance, if I am going to write a hello world program, I
> open up a text editor, type in the code, save it, and then run it by
> typing:
>
> ruby myProgram.rb
>
> I realize that you could do the same thing in irb, but editing is
> easier
> in a text file. So, as far as I can tell, you don't ever have to use
> irb to learn Ruby. Is there something important about irb that I am
> missing?

I don't think you're missing anything. If you use a text editor with
first-class support for Ruby (e.g., TextMate on OS X), your need for
irb rapidly approaches zero.

Irb is often cited as a great way to do exploratory coding such as
checking on what methods are available to an object. I can do
exploratory coding without firing up irb because I can evaluate code
snippets from within a TextMate edit buffer. Here is an example, cut
from TextMate and pasted here:

<code>
(Array.new.methods - Object.new.methods).sort # => ["&", "*", "+",
"-", "<<", "<=>", "[]", "[]=", "all?", "any?", "assoc", "at",
"clear", "collect", "collect!", "compact", "compact!", "concat",
"delete", "delete_at", "delete_if", "detect", "each", "each_index",
"each_with_index", "empty?", "entries", "fetch", "fill", "find",
"find_all", "first", "flatten", "flatten!", "grep", "include?",
"index", "indexes", "indices", "inject", "insert", "join", "last",
"length", "map", "map!", "max", "member?", "min", "nitems", "pack",
"partition", "pop", "push", "rassoc", "reject", "reject!", "replace",
"reverse", "reverse!", "reverse_each", "rindex", "select", "shift",
"size", "slice", "slice!", "sort", "sort!", "sort_by", "to_ary",
"transpose", "uniq", "uniq!", "unshift", "values_at", "zip", "|"]
</code>

Further, in a TextMate edit buffer, I can highlight any method name
and get the ri documentation on the method just by hitting ctrl-H. I
also find it easy to run unit tests and benchmarks from within
TextMate -- two things I find awkward to do from irb.

But my point is not to sing the praises of TextMate. I like a lot,
but there are other editors that can perform the same or similar
feats. My main point is a really good code editor trumps irb.

Regards, Morton

7stud 7stud

3/12/2007 8:14:00 AM

0

Morton Goldberg wrote:
> On Mar 12, 2007, at 1:34 AM, 7stud 7stud wrote:
>
>> open up a text editor, type in the code, save it, and then run it by
>> typing:
>>
>> ruby myProgram.rb
>>
>> I realize that you could do the same thing in irb, but editing is
>> easier
>> in a text file. So, as far as I can tell, you don't ever have to use
>> irb to learn Ruby. Is there something important about irb that I am
>> missing?
>
> I don't think you're missing anything. If you use a text editor with
> first-class support for Ruby (e.g., TextMate on OS X), your need for
> irb rapidly approaches zero.
>
> Irb is often cited as a great way to do exploratory coding such as
> checking on what methods are available to an object. I can do
> exploratory coding without firing up irb because I can evaluate code
> snippets from within a TextMate edit buffer. Here is an example, cut
> from TextMate and pasted here:
>
> <code>
> (Array.new.methods - Object.new.methods).sort # => ["&", "*", "+",
> "-", "<<", "<=>", "[]", "[]=", "all?", "any?", "assoc", "at",
> "clear", "collect", "collect!", "compact", "compact!", "concat",
> "delete", "delete_at", "delete_if", "detect", "each", "each_index",
> "each_with_index", "empty?", "entries", "fetch", "fill", "find",
> "find_all", "first", "flatten", "flatten!", "grep", "include?",
> "index", "indexes", "indices", "inject", "insert", "join", "last",
> "length", "map", "map!", "max", "member?", "min", "nitems", "pack",
> "partition", "pop", "push", "rassoc", "reject", "reject!", "replace",
> "reverse", "reverse!", "reverse_each", "rindex", "select", "shift",
> "size", "slice", "slice!", "sort", "sort!", "sort_by", "to_ary",
> "transpose", "uniq", "uniq!", "unshift", "values_at", "zip", "|"]
> </code>
>
> Further, in a TextMate edit buffer, I can highlight any method name
> and get the ri documentation on the method just by hitting ctrl-H. I
> also find it easy to run unit tests and benchmarks from within
> TextMate -- two things I find awkward to do from irb.
>
> But my point is not to sing the praises of TextMate. I like a lot,
> but there are other editors that can perform the same or similar
> feats. My main point is a really good code editor trumps irb.
>
> Regards, Morton

Thanks for the response. I'm actually interested in TextMate as well.
Do you know if I can create my own auto completion snippets in TextMate.
For instance, I currently use an editor where I can assign any character
sequence to a code snippet. Then if I type the character sequence and
hit the space bar, the code snippet is entered. I also use the auto
completion a lot just for long method names; I type one or two
characters and hit the space bar, and bang, the method name is inserted.
It's very easy to add new character sequences and the corresponding code
I want attached to the character sequence. It's also an extremely fast
to have the space bar as the trigger for the auto completion.



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

John Joyce

3/12/2007 8:52:00 AM

0

Let's just say that irb is worth learning to use and useful to know.
It can be a lot quicker than Creating a new file, changing
permissions on it and executing it. You can explore side effects and
snippets very quickly. You can even open a file's contents in irb.
One thing is for sure, if you have Ruby on a system, you have irb.
While learning Ruby, irb is useful.
TextMate is easy enough to start using, but like all good editors
there is a learning curve. The auto completion isn't what you might
expect from a full IDE like XCode or VisualWhatever. But it is a good
quality app with a small footprint, not demanding of the system, and
pretty robust.
The cool thing is the way TextMate just implements existing OS X
software to do things like test run your code or validate or preview
pages. It's really sort of a testament to the volume of good
libraries in the Cocoa framework being used in ways they are meant to
be used.
At first I wasn't sure if it was worth the price, but the more I used
it, I quickly felt it was worth more.

Brian Candler

3/12/2007 9:01:00 AM

0

On Mon, Mar 12, 2007 at 11:06:48AM +0900, Marc Heiler wrote:
> I have both. My personal opinion, and I am biased, is that
> the ruby book is very good. I (still) often use it for reference.

I have both books and I recommend them highly. The style suits me well:
logically presented, lots of examples, easy to search, minimal padding.

> The Rails book well ... I think a disadvantage _is_ that it is
> very speficic to rails.

To me, that's an advantage. When I buy a 700-page book about Rails, I want
most of those pages to be about Rails. This is the DRY principle applied to
paper :-)

The Agile RoR book has a 13-page appendix about Ruby itself, but more as a
taster than anything. If the OP is planning to buy both books, then I think
he'll be happy with both. You're right that he shouldn't just by the RoR
book by itself, unless he's already learned most of Ruby online.

Regards,

Brian.

Chad Perrin

3/12/2007 9:08:00 AM

0

On Mon, Mar 12, 2007 at 10:35:08AM +0900, Robert Hicks wrote:
> I would like to learn Ruby so I am looking at getting "Programming
> Ruby". I am also looking at converting stuff to RoR, so I was looking
> at getting "Agile Web Development with Rails".
>
> Would those be good?

The short answer: "It depends."

Programming Ruby, also known as "the Pickaxe" because of the pickaxe on
the front cover, is an excellent book for people who are already
programmers in (an)other language(s). It's also a very nice reference
to have on your shelf. If you're a brand new, or relatively novice,
programmer, you might want to choose something that does a little more
hand-holding in the early stages of learning Ruby (and learning to
program in general). Programming Ruby basically assumes you know most
of the concepts of programming that come up in the first few chapters,
but don't know how they apply in Ruby.

So -- if you're a programmer already, Programming Ruby's an excellent
choice. If you've never programmed before, or have only barely touched
program source code (such as doing some very simple imperative stuff
with PHP or JavaScript), you'd probably be better served by choosing a
book like Chris Pine's "Learning to Program".

There's now an effective middle road, in the form of another book called
"Everyday Scripting with Ruby". You might want to have a look at that
while you're deciding as well. There are other books available, but
these are the three with which I'm familiar that I know are at least
reasonably good. In fact, from what I've seen, all three are truly
excellent -- they just target different audiences. They are also,
conveniently, all published under the Pragmatic Programmers imprimatur.

"Agile Web Development with Rails" is also an excellent book, but not
for learning Ruby, per se. It's an excellent book for learning Rails
itself, the framework. You really don't need to know much Ruby to do
basic Rails development -- though if you start using Rails heavily you
will *definitely* benefit from learning Ruby itself pretty heavily. If
you're already a PHP web developer, you should be able to get started
with Rails pretty quickly with the Rails book by starting with the
appendix that gives a brief overview of the Ruby language. That'll help
you translate programming concepts from a language like PHP to Ruby,
insofar as is needed to do basic work with Rails. Surprise: Agile Web
Development with Rails is also a Pragmatic Programmers book, and of a
high quality similar to the others I've mentioned.

While I'm talking about the PragProgs, I should mention where the
Pragmatic Programmers name arose: Some time ago, Dave Thomas and Andrew
Hunt wrote a book called The Pragmatic Programmer. It doesn't teach any
particular programming language, and in fact doesn't teach you to
program, really. It does, however, provide excellent details on how to
be a *good programmer*, once you already know how to program,
*regardless of the language*. I recommend it wholeheartedly, as one of
the seminal works of programming practice.

Back on topic: If you're serious about Rails, and want to start with
Rails then move into Ruby, I suspect that the second book you should
pick up after Agile Web Development is a book called "Ruby for Rails".
I haven't had a chance to go through it at all, but by reputation it is
an excellent book as well, and teaches Ruby programming from a Rails
perspective, going beyond merely teaching the framework and the minimum
of Ruby knowledge necessary to use Rails.

I hear good things about "The Ruby Way", as well. I salivate for this
book, and will probably get it next month. It's probably a good second
or third Ruby book (depending on how much programming you know when you
start with Ruby and how quickly you learn the language).

Neither Ruby for Rails nor The Ruby Way is a Pragmatic Programmers book,
but don't let that deter you. I've heard nothing but glowing
recommendations in relation to these two books. I can't personally
vouch for them, but I certainly have heard enough to be reasonably sure
I wouldn't waste my money to purchase them.

I hope that helps.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
"The ability to quote is a serviceable
substitute for wit." - W. Somerset Maugham

Chad Perrin

3/12/2007 9:12:00 AM

0

On Mon, Mar 12, 2007 at 02:34:48PM +0900, 7stud 7stud wrote:
> Marc Heiler wrote:
> > on IRC it happens too often
> > that people on rails dont know irb, and it can
> > be frustrating to tutor people that are only, mostly interested
> > in rails)
> >
>
> I don't understand the distinction between "learning irb" and "learning
> Ruby". For instance, if I am going to write a hello world program, I
> open up a text editor, type in the code, save it, and then run it by
> typing:
>
> ruby myProgram.rb
>
> I realize that you could do the same thing in irb, but editing is easier
> in a text file. So, as far as I can tell, you don't ever have to use
> irb to learn Ruby. Is there something important about irb that I am
> missing?

Actually, irb is basically just a command shell that uses Ruby as its
scripting language, rather than something like bash, csh, or DOS batch
files. It's an exceedingly nice command shell, though, and is worth
learning for its own sake -- I use it as my calculator application,
among other things. It helps with testing snippets of code when you
want to test them before including them in a file you're editing, and
you can use it for interactive language exploration.

When I'm actually writing "serious" Ruby code, of course, I save it to a
file in my text editor (I use Vim for that). I find that irb serves as
an indispensable aid a lot of the time, however. Your mileage may vary.

You don't *have* to use irb to learn Ruby, but sometimes it's pretty
nice anyway.

--
CCD CopyWrite Chad Perrin [ http://ccd.ap... ]
"There comes a time in the history of any project when it becomes necessary
to shoot the engineers and begin production." - MacUser, November 1990