I’m having a hard time learning ruby.

N

Nate Imaqaguy

For starters, just do you know where I’m coming from: I have little to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I’m trying to
accomplish.

I’m use to being able to perform a search, like in MSDN Library, using
key words of something I’m trying to perform. Then research results
from there, and get pointed in the right direction (with explanations on
what the feature does, and examples, etc).

The editors also helped with showing the available methods, as I wrote
the code.

So, with ruby, I’m using the SciTE editor (on WinXP), which doesn’t give
method options as you go. Yeah, I know they are kinda like training
wheels, but they help when you’re starting out.

And I can’t really find any close equivalent to using something like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it’s not really
“searchableâ€â€”you kind of have to know what file/class/method to look up
in the first place. And even if I find what I think I’m looking for,
the documentation is confusing to me. Sometimes there isn’t the
slightest word as to what something does.

Someone told me about “.methodsâ€, but that only works if you’re in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can’t even figure out how to paste each line
of the code I already have. Inevitably I fat finger something and get
mad.

So, you can kinda see a n00bs frustration….

I must be missing something big. Any tips (other than “try not to suck
so muchâ€)?

= )
 
M

Matt Todd

Do you have the Pick-Axe (Programming Ruby from the Pragmatic
Programmers)? If not, I highly recommend you pick that up. And, while
you're at it, pick up the Ruby Recipes, which will have tons of
example code for all kinds of things you might want to do!

M.T.
 
Y

yesmar

Just read this: http://www.rubycentral.com/book/

---
Ramsey <[email protected]>
GPG fingerprint =3D 0E28 4713 428E AC4E AE05 A4A6 D70B 321D 7188 3AD0


For starters, just do you know where I=92m coming from: I have little = to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I=92m trying = to
accomplish.

I=92m use to being able to perform a search, like in MSDN Library, = using
key words of something I=92m trying to perform. Then research results
from there, and get pointed in the right direction (with =20
explanations on
what the feature does, and examples, etc).

The editors also helped with showing the available methods, as I wrote
the code.

So, with ruby, I=92m using the SciTE editor (on WinXP), which doesn=92t = =20
give
method options as you go. Yeah, I know they are kinda like training
wheels, but they help when you=92re starting out.

And I can=92t really find any close equivalent to using something =20
like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it=92s not = really
=93searchable=94=97you kind of have to know what file/class/method to =20=
 
D

Dark Ambient

As a newb myself I always find some delight in the realization that
other people are struggling as well. So, in reality I can't address
specifically the parallels you are looking for between past languages
and Ruby.
My suggestion though would be to read up , books, like Programming
Ruby, edition 1 is available online and 2nd edition for sale as a pdf
and / or hard copy. IRB is your friend because it helps you test code
in a very fast way. I do believe one thing - that the time you study
and soak in the material will be returned via Ruby's incredible
pseduo-code like style. There are many methods that will make things
so much easier then most other languages. Maybe I'm just naive and
could even be wrong but after about a month now , is how I see things.

Stuart
 
C

Chad Perrin

=20
My biggest hurdle getting started with ruby is finding which=20
methods/classes/files to call upon for whatever the heck I=E2=80=99m tr= ying to=20
accomplish.
=20
I=E2=80=99m use to being able to perform a search, like in MSDN Library= , using=20
key words of something I=E2=80=99m trying to perform. Then research re= sults=20
from there, and get pointed in the right direction (with explanations o= n=20
what the feature does, and examples, etc).

That seems to be a common problem for languages I like: discoverability
sucks (relative to that in languages I don't like, unfortunately). One
tends to end up needing to ask questions of people rather than simply
looking up the answers oneself, much of the time. Somehow, I've managed
anyway.

It mostly sounds like what you need is a good reference, and not so much
an instructional book. I hesitate to say "go spend money" -- it would
be awfully nice if there were a free solution to this problem. I don't
really see such a thing available, though. As such, perhaps you should
look into getting O'Reilly's "Ruby In A Nutshell". The Nutshell series
of books from O'Reilly are designed specifically as references full of
listings of the options available, with brief descriptions, presented in
a non-tutorial, searchable manner. If you get an O'Reilly CD Bookshelf
for subjects of interest, you'll likely end up with a digital copy of
the Nutshell reference for that subject matter, which makes it even more
searchable. I don't even know whether there's a CD Bookshelf for Ruby,
though, unfortunately.

=20
So, with ruby, I=E2=80=99m using the SciTE editor (on WinXP), which doe= sn=E2=80=99t give=20
method options as you go. Yeah, I know they are kinda like training=20
wheels, but they help when you=E2=80=99re starting out.

On the rare occasion when I find myself forced to work with text files
of any sort (source code, notes to self, et cetera) on a Windows
machine, SciTE is definitely my preferred way to do it. It's an
excellent programming, and general purpose, text editor. The fact that
it's not designed by someone who's trying to push a programming language
"product", however, ensures it's not going to be encumbered by language
documentation. The lack of such does have its downside.

I wish I had more useful advice to offer on the subject.

--=20
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"The measure on a man's real character is what he would do
if he knew he would never be found out." - Thomas McCauley
 
M

Morton Goldberg

My recommendation is: go to

http://pragmaticprogrammer.com/titles/ruby/index.html

Order both the print and PDF versions of the Programming Ruby book --
you get a special price if you order both together. The PDF is
searchable on your computer in the way that have described.
I find myself searching it several times every day.

Your frustration level and blood pressure should quickly return to
normal :)

Regards, Morton
 
L

Leslie Viljoen

For starters, just do you know where I'm coming from: I have little to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I'm trying to
accomplish.

I'm use to being able to perform a search, like in MSDN Library, using
key words of something I'm trying to perform. Then research results
from there, and get pointed in the right direction (with explanations on
what the feature does, and examples, etc).

I find VS.NET 2003 has a fast and useful help system, but 2005 is way
slow. With Ruby I have a PDF of the Pickaxe book and also bought the
PDF version of Hal Fulton's "The Ruby Way". Using the latest Acrobat
Reader's search features, I get close to the MSDN effect. Beyond that
I use the "Forum Search" - ask a question on Ruby-Talk and normally
within 5 minutes you have 5 answers!
The editors also helped with showing the available methods, as I wrote
the code.

So, with ruby, I'm using the SciTE editor (on WinXP), which doesn't give
method options as you go. Yeah, I know they are kinda like training
wheels, but they help when you're starting out.

I think normal Intellisense would be impossible to do for Ruby because
every variable can be any object at any time. So an editor would have
to run your program to find out what methods a variable supports at a
certain point. That said, Radrails does have limited code completion.
And I can't really find any close equivalent to using something like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it's not really
"searchable"=97you kind of have to know what file/class/method to look up
in the first place. And even if I find what I think I'm looking for,
the documentation is confusing to me. Sometimes there isn't the
slightest word as to what something does.

You should buy the PDF versions of a couple of Ruby books and search them.
Someone told me about ".methods", but that only works if you're in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can't even figure out how to paste each line
of the code I already have. Inevitably I fat finger something and get
mad.

I often start in IRB and then make a mistake and have to do it all in
the editor again. Best to just use an editor. Scite can run your code
quickly - just go to Tools->Go. Radrails can also run your code inside
the IDE.
So, you can kinda see a n00bs frustration=85.

I must be missing something big. Any tips (other than "try not to suck
so much")?

Keep at it! After a while you'll have a ton of examples of how to do
things, and you just reuse your code. Ruby will pay you back ten times
what you put in. "The Ruby Way" has many many code examples too.


Les
 
P

Paul van Delst

Nate said:
For starters, just do you know where I’m coming from: I have little to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I’m trying to
accomplish.

I’m use to being able to perform a search, like in MSDN Library, using
key words of something I’m trying to perform. Then research results
from there, and get pointed in the right direction (with explanations on
what the feature does, and examples, etc).

The editors also helped with showing the available methods, as I wrote
the code.

So, with ruby, I’m using the SciTE editor (on WinXP), which doesn’t give
method options as you go. Yeah, I know they are kinda like training
wheels, but they help when you’re starting out.

And I can’t really find any close equivalent to using something like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it’s not really
“searchableâ€â€”you kind of have to know what file/class/method to look up
in the first place. And even if I find what I think I’m looking for,
the documentation is confusing to me. Sometimes there isn’t the
slightest word as to what something does.

Oh man, you have just described my recent experiences to a T. Although it's not
searchable, the on-line version of the Programming Ruby "pickaxe" book,
http://www.rubycentral.com/book
does do a pretty good job of listing just about everything built in on one page:
http://www.rubycentral.com/book/builtins.html

After reading the paper version of the Pickaxe book, I bought a PDF version (only 10
bucks) of the Pickaxe (see http://www.pragmaticprogrammer.com) and keep it open on my
desktop - along with the builtin library page above, and the Ruby-doc.org page you
mentioned. I'm still in the hunting and gathering stage of ruby coding, but having those
three resources available -- along with Google -- as I'm editing ruby code has been
invaluable. In addition there are quite a number of webpages out there containing teaching
examples and code snippets.

Oh, and the Ruby Cookbook is a must have too (although it's a hefty beast at 900-odd
pages...and it doesn't look like it will be released as a PDF book anytime soon.)
Someone told me about “.methodsâ€, but that only works if you’re in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can’t even figure out how to paste each line
of the code I already have. Inevitably I fat finger something and get
mad.

I hear ya. On my Mac laptop, I haven't figured out how to get command line recall+traverse
(up/down,left/right arrows) yet in irb. Drives me nuts. But you can play around within a
regular source file rather than use irb directly. Sometimes I just play around at the end
of a source file, e.g.

-------- in file fruit.rb ---------
#!/usr/bin/env ruby
class Fruit
def initialize
@bananas=0
end
def pick
@bananas += 1
end
def eat
@bananas -= 1
end
def howmany?
@bananas
end
end

# Muck around test code for above classes follows.....
fruit=Fruit.new
puts "Picking some fruit...."
(1..10).each {|i| fruit.pick}
puts "Eating some fruit...."
fruit.eat
puts "I have #{fruit.howmany?} piece(s) of fruit left."
---------------------------------

And then simply do

$ ruby -w fruit.rb

on the command line or, in irb, use "require"

irb(main):001:0> require 'fruit'
Picking some fruit....
Eating some fruit....
I have 9 piece(s) of fruit left.
=> true

to see if the stuff after the "actual" code (e.g. classes, modules, whatnot) does what I
think it does. If not, I modify, save, and re-run.


Extremely low-tech .... but I'm having a ball. :eek:)

cheers,

paulv
 
M

Mat Schaffer

For starters, just do you know where I=92m coming from: I have little = to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I=92m trying = to
accomplish.

I=92m use to being able to perform a search, like in MSDN Library, = using
key words of something I=92m trying to perform. Then research results
from there, and get pointed in the right direction (with =20
explanations on
what the feature does, and examples, etc).

The editors also helped with showing the available methods, as I wrote
the code.

So, with ruby, I=92m using the SciTE editor (on WinXP), which doesn=92t = =20
give
method options as you go. Yeah, I know they are kinda like training
wheels, but they help when you=92re starting out.

And I can=92t really find any close equivalent to using something =20
like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it=92s not = really
=93searchable=94=97you kind of have to know what file/class/method to =20=
look up
in the first place. And even if I find what I think I=92m looking = for,
the documentation is confusing to me. Sometimes there isn=92t the
slightest word as to what something does.

Someone told me about =93.methods=94, but that only works if you=92re = in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can=92t even figure out how to paste each = line
of the code I already have. Inevitably I fat finger something and get
mad.

So, you can kinda see a n00bs frustration=85.

I must be missing something big. Any tips (other than =93try not to =20=
suck
so much=94)?

=3D )

I share your frustration. I have yet to find any really nice, =20
interactive ruby documentation. I think part of the problem is that =20
the core of the language isn't even fully documented. But ruby-=20
doc.org is doing a lot of work to fix this problem.

Contrary to a lot of people on this list, I don't recommend Pickaxe =20
for introduction. It is awesome reference, but I found it really dry =20=

as an introductory text. If you have a good sense of humor and some =20
patience, I'd recommend The Poignant Guide http://poignantguide.net/=20
ruby/.

Then to get some early practice with the ideas, I'd recommend =20
rubyquiz.com. There's a lot of nice little exercises there with lots =20=

of source code and analysis for each problem. (Note: download all =20
the solutions, as some of the older individual solutions reference =20
mailing list archives that are no longer available).

Finally, when you're stuck, ask a question here. It's one of the =20
nicest programming lists I've ever been on.
-Mat
 
B

Bill Kelly

From: "Nate Imaqaguy said:
Someone told me about “.methodsâ€, but that only works if you’re in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can’t even figure out how to paste each line
of the code I already have. Inevitably I fat finger something and get
mad.

On Windows, I've found running irb as:

irb --noreadline

can provide more hassle-free support for line editing / copy / paste and
command history in irb.



Hope this helps,

Bill
 
N

Nate Imaqaguy

Cool; thanks for all the feedback--excellent info.

I especially like the idea of searching the digital books to get the
MSDN effect. I hadn't thought about that.

-nate
 
J

James Britt

Mat said:
I share your frustration. I have yet to find any really nice,
interactive ruby documentation. I think part of the problem is that
the core of the language isn't even fully documented. But ruby- doc.org
is doing a lot of work to fix this problem.

I'm always glad to hear when someone finds the site helpful. But I do
want to make clear that the actual documentation comes from a relatively
small number of very smart, very dedicated Rubyists who volunteer to add
and correct the documentation.
Contrary to a lot of people on this list, I don't recommend Pickaxe for
introduction. It is awesome reference, but I found it really dry as an
introductory text. If you have a good sense of humor and some
patience, I'd recommend The Poignant Guide http://poignantguide.net/ ruby/.

I'd highly recommend David A. Black's Ruby for Rails. Doesn't matter if
you know or use Rails; you can look at the references to Rails as just
an example application used to illustrate essential Ruby language
features. (Of course, if you do use Rails then the book is perhaps even
more useful.)


--
James Britt

"The greatest obstacle to discovery is not ignorance, but the illusion
of knowledge."
- D. Boorstin
 
M

Matt Todd

But, really, with all of this frustration... it's better than the
frustrations just about anything else will give you... :)

M.T.
 
P

Patrick Hurley

Cool; thanks for all the feedback--excellent info.

I especially like the idea of searching the digital books to get the
MSDN effect. I hadn't thought about that.

-nate

Also as you come from a Win32 background, rdoc (the tool used to
generate much of the API docs for Ruby), can create (if you have
HTMLHelp) chm files, which might feel very comfortable as well.

pth
 
P

Paul van Delst

Seth said:
Don't forget ri!

$ ri Array#each
$ ri Enumerable

BTW, do other folks get this i_formatter.rb warning when they use ri:

lnx:local/ruby-1.8.4 : ri Array#each
/usr/local/lib/ruby/1.8/rdoc/ri/ri_formatter.rb:46: warning: (...) interpreted as grouped
expression

.....followed by the actual rdoc output....



?? I get it on linux and mac osx

cheers,

paulv
 
L

Leslie Viljoen

Cool; thanks for all the feedback--excellent info.

I especially like the idea of searching the digital books to get the
MSDN effect. I hadn't thought about that.

Something else that helps with that is Google Desktop. It can index
PDF files so you can do a more fuzzy search than the strict one you
can do in Abobe Reader.

Though PDF's protected with DRM can probably defeat Google Desktop,
which is just another reason to be wary of them.

Les
 
J

Just Another Victim of the Ambient Morality

Nate Imaqaguy said:
For starters, just do you know where I'm coming from: I have little to
no programming experience, except for some C and VB classes I took 6
years ago, which I did fine in.

This is, perhaps, your biggest hurdle, in my opinion. As much as I love
Ruby, I've always been suspicious of Ruby as a first language. It's so free
and lacks any kind of hand-holding, which is a breath of fresh air for
experienced programmers but can be a hurdle for novices...

My biggest hurdle getting started with ruby is finding which
methods/classes/files to call upon for whatever the heck I'm trying to
accomplish.

However, if this is your only problem then you're probably a more
competent programmer than you let on. If that's the case, Paul's suggestion
of this reference will be valuable to you:

http://www.rubycentral.com/book/builtins.html

It's not exactly searchable but, if you know what kind of behaviour
you're looking for, you can probably simply guess what you're looking for
and be right. For instance, if you're looking for string concatenation,
then you can guess that it will be a method of the "String" class and then,
look at all the methods of that class for something that might suggest
concatenation. You can get quite far doing simply this...

I'm use to being able to perform a search, like in MSDN Library, using
key words of something I'm trying to perform. Then research results
from there, and get pointed in the right direction (with explanations on
what the feature does, and examples, etc).

I'm an experienced MS Windows developer and I am, thus, intimately
familiar with both the Win32 API and the MSDN Library and, yet, despite all
this, I've never found the search tool (as you've described it) useful, so I
can't help you here.

I don't know if this is considered rude or not but, since the Pickaxe
book is available online at:

http://www.rubycentral.com/book/

...you could simply suck down the entire site and perform your search on
the HTML, all for free. Again, I don't know how the community feels about
you downloading the entire online "book," so my apologies if this is
considered rude...

And I can't really find any close equivalent to using something like an
MSDN Library. The best thing someone has pointed me to so far is
http://www.ruby-doc.org/. Which is cool and all, but it's not really
"searchable"-you kind of have to know what file/class/method to look up
in the first place. And even if I find what I think I'm looking for,
the documentation is confusing to me. Sometimes there isn't the
slightest word as to what something does.

Embarrassingly enough, I wasn't aware of ruby-doc.org before and, now
that I'm looking at it, it looks like an excellenet reference, which doesn't
bode well for the advice I have given you up til now. I haven't scrutinized
it but ,judging from the documentation for class "Array," it looks rather
thorough. Are you looking up more obscure functionality?

Someone told me about ".methods", but that only works if you're in an
irb session, which I find painful to use because I have to type all my
code in, line by line. I can't even figure out how to paste each line
of the code I already have. Inevitably I fat finger something and get
mad.

The "methods" method works anywhere in Ruby but it is most useful in an
IRB session.
I'm unsure why you want to type in your entire program into IRB. You
probably just want to type in relevant situations to test Ruby's behaviour,
such as operator precedence or regex behaviour.
If you want to look at all the methods of a class, you simply need to
create an object of said class and call the "methods" method, perahps
followed by the "sort" method which can help you find what you're lookig
for...

So, you can kinda see a n00bs frustration..

I must be missing something big. Any tips (other than "try not to suck
so much")?

I assure you, we're all familiar with frustration, even if it's not over
the same things.
Good luck to you and I hope you make progress!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top