Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Idea: Ruby Tutorial For Newbies

Reply
Thread Tools

Idea: Ruby Tutorial For Newbies

 
 
simonh
Guest
Posts: n/a
 
      01-15-2006
Hello all. I am learning to program with ruby but I'm struggling to
find a really good tutorial or book aimed at beginners. The pickaxe 2nd
ed. is an incredible book but can be a little intimidating for
beginners. Many of the other books cover ruby 1.6. The available
tutorials I've found either don't go far enough or spend too long
telling stories (sorry Why)! Anyway, I think it would be beneficial to
have a set of tutorials in the form of dialogues similar to the
artcompsci project:

link: http://www.artcompsci.org/kali/development.html

but aimed at non mathematical problems. Here is a sample of what I am
proposing: (bear in mind I am a newby too). I think it would be better
for a ruby guru to write the dialogues.

-----------------------------------------------------------------------------------------------------------------------------------
T- Teacher
S- Student


T: Ok lets get started. Here is a 'hello world' program. This is
usually the first program a student writes in any programming language.
All it does is print the phrase Hello World onto the screen.

puts "Hello World"


>Hello world



T: How do you think this program works?


S: It looks to me like the word puts is a command. The phrase Hello
World is the text that the command should print out. I'm not sure why
the phrase is quoted though. The quotes don't appear on the screen.

T: Well spotted. The phrase Hello World is what we call a String. We
identify Strings by enclosing text within quotation marks. We use
single ( ' ) and double ( " ) quotes in Ruby. We'll come to the
differences between using single or double quotes later on. You
suggested that puts was a command. In fact it's a method. Methods are a
core concept of Ruby so fix that in your mind. Here is a description of
what the program is doing: The method puts receives the String Hello
World as its argument. puts is a method defined in the Kernel module.
We'll come to that later as well.

S: Does it matter if puts is upper or lowercase?

T: Try it out

S: Puts "Hello World"

>beginner.rb:1: undefined method `Puts' for main:Object (NoMethodError)
>Exit code: 1


S: Obviously it doesn't work. An error message has been printed.

T: You should get used to reading error messages straight away. Ruby is
telling us that the error occurred in line 1 beginner.rb:1 it then
tells us the error. We have not defined a method 'Puts' for main:Object
In Ruby methods should always be lowercase. Classes, Modules and
Constants are uppercase. For now don't worry about any of these new
terms. We will cover them before long.

S: It seems there is a lot of stuff we will be covering later on!

T: Yes I know. Its quite hard to know where to start with someone who
has no programming experience. My plan is to introduce you to some
basic Ruby and then explain things at the right time. I promise you'll
understand all of these concepts before long.

S: Ok, I'll take your word for it. What's next?

T: Rather that use the method puts we can use print instead

print "Hello World"

>Hello World


T: The difference is that puts will print the string and insert a
newline character where as print will not. See the cursor is now on the
same line? Change print to puts and see where the cursor is then.

S: Oh right. Yep I see what you mean.

T: Try this

puts "Hello World"
puts "I am learning Ruby!"

>Hello World
>I am learning Ruby!


T: Now do the same thing with print

print "Hello World"
print "I am learning Ruby!"

>Hello WorldI am learning Ruby!


 
Reply With Quote
 
 
 
 
simonh
Guest
Posts: n/a
 
      01-15-2006
Maybe people could volunteer to do a chapter.

The Basics
Classes and Modules
Variables
Ruby Way
Regular Expressions
IRB
etc


The possibilities are endless. The entire standard library could be
covered?

 
Reply With Quote
 
 
 
 
anne001
Guest
Posts: n/a
 
      01-15-2006
>I've found either don't go far enough or spend too long
>telling stories (sorry Why)


What you are proposing seems to me to have too many words, and to
suggest something so basic, it won't go anywhere fast.

 
Reply With Quote
 
anne001
Guest
Posts: n/a
 
      01-15-2006
>I've found either don't go far enough or spend too long
>telling stories (sorry Why)


What you are proposing seems to me to have too many words, and to
suggest something so basic, it won't go anywhere fast.

 
Reply With Quote
 
rickhg12hs@gmail.com
Guest
Posts: n/a
 
      01-15-2006
Have a look at Chris Pine's Tutorial:

http://pine.fm/LearnToProgram/

Is this what you've been looking for?

 
Reply With Quote
 
simonh
Guest
Posts: n/a
 
      01-15-2006
thanks for the replies everyone. had a new idea - the pickaxe
companion. the new idea is to expand on the ideas from that famous book
with more concrete, real world examples.

richhg12hs - yes seen that tutorial. not the updated version though. it
looks very good. i'm going to read through it now

 
Reply With Quote
 
simonh
Guest
Posts: n/a
 
      01-15-2006
i think i'd better buy 'learn to program' by chris pine. this might be
just what i need

 
Reply With Quote
 
Adam Sanderson
Guest
Posts: n/a
 
      01-16-2006
What about http://tryruby.hobix.com/ ? It actually works the way you
describe for the most part. It's a lot more down to earth than say the
Poignant Guide The scripts Why uses are just basic htm with some
class markup, so anyone can make new ones.
.adam

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How we recognize newbies as newbies Alf P. Steinbach C++ 31 08-21-2007 05:12 PM
ISE webpack online demos and VHDL tutorial for newbies sham3036 VHDL 0 07-14-2006 05:35 PM
Tutorial for Newbies Ralph Computer Support 1 07-18-2005 11:22 PM
Re: Newbies? - Usenet don't need no steenking newbies! =?iso-8859-1?Q?=B1?= Digital Photography 2 07-17-2004 02:26 PM
[INFO] Tomcat Tutorial for newbies Juan Antonio Agudo Java 0 01-14-2004 11:46 PM



Advertisments