Printing why's (poignant) guide to ruby

J

Joao Pedrosa

Hi,
Um yeah the whole program is syntactically wrong. Fortunately Python
tells you there's an error on practically every single line.

This is the required behaviour of good languages. When there is a
detectable error, tell it to the user/programmer.
Learning and understanding syntax is one of the first steps of a
newbie, even with something like Scheme which doesn't really have much
of a syntax. I believe it is an important first step.

Every step is important, even making money after getting to know the
language better. :)
If you don't have a clue about the basics like this, you'll soon fail
miserably whether you're using Ruby or not. And come-on, who's going
to explain yield and blocks to a newbie?

We just take what we can handle. No need to explain everything that a
language can do before someone can write his programs. I remember a
kid that would use lots of lines in his code until he learned how to
make a loop.
Why do you think Java became so popular? The creators have often said
it is because the language started out with a relatively small number
features and wasn't overwhelming to intermediate programmers.

Java was meant was an embedded systems language. It is obviously being
used in wrong places than its creators had envisioned.

Why don't you let him learn Java, then? The same language of the pros?
That's right. It certainly isn't the most newbie-friendly language out
there. It demands lots of reading/asking/figuring out until one can be
reasonably proficient with it. But I know that some kids love Java.
They are 12 or 13 years old and already do some Java. So it's
possible. :)

That said, the reason that I don't use Java is probably because
Microsoft didn't support it in a good way and never will. So while
Java and DotNet are fighting, I prefer to try to eat their lunch. :)
I'm trying to context-switch to the point of view of a newbie. I
believe starting small is important when learning.

We are the guys who make languages, tools, operating systems and
programs complex in the first place. I don't think that we can think a
lot like the users of our systems.

Cheers,
Joao
 
A

Alexander Kellett

If you don't have a clue about the basics like this, you'll soon fail
miserably whether you're using Ruby or not. And come-on, who's going
to explain yield and blocks to a newbie?

context switch required.
blocks are trivial to understand.
creation of looping constructs
isn't exactly needed in the first
weeks of programming even.

Alex
 
R

Raphael Bauduin

Richard said:
I'd like to try ruby on non-programmers teaching them using why's amazing
guide, to see how it works as a beginner's language. I showed some ruby
code to my 45 year old lodger who has never used a computer or seen a
computer program. He said "it looks like English, I thought computer
programming was maths". And he is especially impressed with the cartoon
foxes in Chapter 3, they have got to be the killer feature..

But it would be great to be able to print the guide out as a PDF. Is there a
version with markup available, so it can translated to a PDF to make it
easier to print?

About printing the guide:
If you can't get a clean printable version, you can always try htmldoc. It's
already helped me for those kind of print jobs.

http://www.htmldoc.org/


Raph
 
J

James Britt

Navindra said:
If you don't have a clue about the basics like this, you'll soon fail
miserably whether you're using Ruby or not. And come-on, who's going
to explain yield and blocks to a newbie?

It wouldn't be the first, or even the second, thing I would teach, but a
newbie needs to learn them so as to stop being a newbie.

I don't think they are as hard to explain as one might think. (Making
full use of them is much harder, but getting the essential idea and
basic syntax and semantics may be pretty straightforward).
Why do you think Java became so popular? The creators have often said
it is because the language started out with a relatively small number
features and wasn't overwhelming to intermediate programmers.

Perhaps *they* say that, but I don't believe it. Java(tm) had (and has)
major corporate marketing, and solved a number of problems in a manner
less convoluted than C++. It did a comparatively good job of stealing
some of the better ideas from earlier languages (semi-OO, use of a VM +
byte code). Plus it let you make crapplets, and the Web was just
emerging when Java arrived.
I'm trying to context-switch to the point of view of a newbie. I
believe starting small is important when learning.

Very true, but Ruby does a better job than most languages at starting
with simple basic operations and building upwards to more powerful
constructs.

There are fewer arbitrary and inconsistent conventions and commands that
require a lot of hand waving to explain.

A risk with any language that is designed to be good for beginners is
that the language may end up being best for beginners. Ruby avoids this.

James
 
J

Jim Weirich

Navindra Umanee said:
I also got confused seeing "yield" there. Hmm, I didn't know Python
supported that.

Don't know if you are aware of it or not, but yield in Python is quite
different than yield in Ruby. Python's yield creates a generator, a
sort-of limited use continuation.
 
A

Alexander Kellett

It's the more abstract stuff (e.g., blocks, high-order functions, even
the notion of a variable) that spooks them.

how can a variable confuse? its just a name. anyone who's done basic
algebra gets it straight away surely?
as for blocks, surely you just provide the use cases? i can't see
[1,2,3].each { |value| } providing much
confusion honestly other than the obvious first blocker - the syntax.
high order functions? what are they then? :p

alex
 
A

Alexander Kellett

reading this again. still shocked...

How is a total beginner going to learn Ruby? By reading Pickaxe? I'm
not talking about a CS student here. My dad lives half-way around the
world from me.

already answered this one.
Besides, Python is a more restricted and syntactically uniform
language. Ruby is more flexible and expressive, but IMHO to really
understand the code you have to know more CS concepts and have a
deeper understanding of the syntax than some people like to admit.

python is confusing as hell. you try to explain why they have to
get the indent levels right on every line. people can't even deal
with the correctness of html (as is obvious given the shit on the web)
never mind python.
Even though in Ruby you can abuse the syntax or treat it glibly --
which makes it look like a nice thing for experienced programmers -- I
think it is better to understand what you are doing first. Python
forces you to understand these issues.

ummm... without some backup i'd have to say you're trolling.
I prefer Ruby but I think Python will be easier for a beginner to
grasp at the beginning, and it has less hurdles as well
documentation/book-wise -- I even saw one of the beginner books
describe how to implement a neat graphical game in a few steps.

chris pines tutorial answers this problem already.
anyways. this is about materials. i doubt that you're
really expecting to shove the python stdlib documentation
in front of your father and get a regexp engine out of
him in the coming days...
And yeah, VB has wizards and stuff on top of plenty of documentation.
Like I said, quicker gratification can be a good thing. Someone used
to fancy windows and GUI stuff probably isn't going to be happy stuck
at the command-line level. Joao makes a good point, of course.

okay. i don't even want to start on this point because it
means one inevitable thing.

<rant>

sorry but this is just getting stupid. "fancy windows and gui stuff"
are you talking about vb? the confusing as crap to advanced and beginner
users piece of cruft that m$ managed to build over the last 10 years
with seemingly no real advancements whatsoever? non resizable
interfaces,
awful damn confusing language syntax, slow as hell on old machines.

gimme my a nicely syntax highlighted irb with gui builder integration
anyday over this crap!

</rant>
 
M

Michael Walter

reading this again. still shocked...

python is confusing as hell. you try to explain why they have to
get the indent levels right on every line. people can't even deal
with the correctness of html (as is obvious given the shit on the web)
never mind python.
FWIW, from my experience "people" have very few problems understanding
indentation in Python.

Michael
 
G

Gavri Fernandez

Alexander Kellett <[email protected]> wrote:
Besides, Python is a more restricted and syntactically uniform
language. Ruby is more flexible and expressive, but IMHO to really
understand the code you have to know more CS concepts and have a
deeper understanding of the syntax than some people like to admit.

No. Ruby is only complex when you work on complex problems. (I mean
that in the sense that the complexity allows for elegant solutions.
Rails for example). When Ruby is used as a tool to teach programming,
there is no reason to use any of the complex constructs.

Python's procedural mix only works against itself for when used to
learn programming.

For someone who is new to programming
"string".display
wouldn't feel less natural than
print "string"

Really, think about that.

And why should we try to teach them the procedural paradigm and then
say 'Hey! forget all that stuff you learnt. It's not really a good way
to program. Now i'll teach you the object-oriented way" ?

Of course, all of this I say assuming that the goal is to create an
object-oriented programmer, not a procedural one.
 
R

Ruth A. Kramer

James said:
It wouldn't be the first, or even the second, thing I would teach, but a
newbie needs to learn them so as to stop being a newbie.

I don't think they are as hard to explain as one might think. (Making
full use of them is much harder, but getting the essential idea and
basic syntax and semantics may be pretty straightforward).

Challenge: Well, how about explaining them (or at least blocks)?

If you attempt it, how about explaining blocks from the point of view of
an ex-Algol, Pascal, PL/1 programmer, for whom a block is just a way of
grouping several statements together so they can all be executed as a
result of some "test" (like if then else, while do, etc.). Is there
something extra or different about a Ruby block? What?

Enquiring newbies want to know ;-)

Randy Kramer
 
A

Alexander Kellett

FWIW, from my experience "people" have very few problems understanding
indentation in Python.

its not about understanding. its about debugging and thusly
incrementally.
unless python got a whole load better since 1.5.1 wrt whitespace
problems,
then its still a joke of a language :)
Alex
 
R

Ruth A. Kramer

Alexander said:
how can a variable confuse? its just a name. anyone who's done basic
algebra gets it straight away surely?

Probably, but a = a + 1 was confusing for me when I first started
programming (30+ years ago) (solving for a gives a = 1/2 ;-)

Of course, I learned algebra a long time ago also, maybe today the
computing paradigm (incrementing a) is more common to incoming algebra
students and a teacher has to explain the algebraic paradigm?

I'm seriously wondering--feedback from anybody that's learned algebra
more recently than I?

Randy Kramer
 
A

Austin Ziegler

Probably, but a = a + 1 was confusing for me when I first started
programming (30+ years ago) (solving for a gives a = 1/2 ;-)

Of course, I learned algebra a long time ago also, maybe today the
computing paradigm (incrementing a) is more common to incoming algebra
students and a teacher has to explain the algebraic paradigm?

I'm seriously wondering--feedback from anybody that's learned algebra
more recently than I?

It's been quite a while for me since I learned algebra as well, but
I'm helping someone learn algebraic equation solving now, and I can
say with certainty that it would be confusing if variables in
programming are equated with algebraic equation solving.

However, if the only thing that is made clear is that a variable is a
"name", just like in algebra, then it's not nearly as big a problem.

-austin
 
A

Alexander Kellett

Probably, but a = a + 1 was confusing for me when I first started
programming (30+ years ago) (solving for a gives a = 1/2 ;-)

maybe i've little experience with people learning later on.
the a' = a + 1 trick usually works to explain whats going on
if people have a background in mathematics.

i learnt algebra just shortly before i learnt to program, and
as i was 7 or so, this affects massively my views on whats easy
and whats not i guess :)

alex
 
M

Marcus Sharp

*putting on flame retardant pants*

As a noob to Ruby who was convinced to try it after reading why's
wonderful work, i will say that i find Ruby "harder" than Python. To
call Python a "joke of a language" is pretty harsh by the way. It is
taking me much, much longer to work my way through the PickAxe book
than it did Learning Python. In just a few days of that book, I wrote
fully functional (albeit very tiny) applications that did what I
needed them to do. As well, at the time, the Python community was
helpful to the noob. Of course, Python doesn't have why, so it loses
on that aspect. :)

I did go and find a used copy of Learn Ruby in 21 Days and it does
seem to be a bit easier to get through so far, but the Ruby syntax is
a bit more work for me whereas in Python I feel like I'm writing
pseudo code that actually works. But that's just me, your average
newbie (or maybe to you I'm an idiot) , and it of course in no way
reflects on the writings mentioned, nor the language. And I do intend
to get through the Ruby books eventually....
 
N

Navindra Umanee

Marcus Sharp said:
As a noob to Ruby who was convinced to try it after reading why's
wonderful work, i will say that i find Ruby "harder" than Python. To
call Python a "joke of a language" is pretty harsh by the way. It is

I did go and find a used copy of Learn Ruby in 21 Days and it does
seem to be a bit easier to get through so far, but the Ruby syntax is
a bit more work for me whereas in Python I feel like I'm writing
pseudo code that actually works. But that's just me, your average
newbie (or maybe to you I'm an idiot) , and it of course in no way

Thanks Marcus, I have to admit some of the comments are making me lose
my cool here. The profanity, and accusations of trolling (with
simultaneous attacks on Python) as well as my unfortunate lack of
sleep are all adding up.

Of course there are some very good points in this thread too. The
matter of teaching programming to a complete newbie is no trivial
matter either way.

I honestly think things like blocks are not a trivial matter.

Why:

5.times { print "hello " }

instead of:

5 times print hello

There is so much going on in '5.times { print "hello" }'. The more
experienced may not give a second thought, but to the enquiring newbie
it's a different matter.

You've expressed what I've been trying to say all along so I think
I'll leave it at that.

Later,
Navin.
 
J

Joao Pedrosa

Hi,
I did go and find a used copy of Learn Ruby in 21 Days and it does
seem to be a bit easier to get through so far, but the Ruby syntax is
a bit more work for me whereas in Python I feel like I'm writing
pseudo code that actually works. But that's just me, your average
newbie (or maybe to you I'm an idiot) , and it of course in no way
reflects on the writings mentioned, nor the language. And I do intend
to get through the Ruby books eventually....

The Pickaxe book has a different style of presenting the language. It
certainly is a different style of book for a different style of
language. If it had many "beginnings and ends", it would be more
newbie-friendly:
http://headrush.typepad.com/creating_passionate_users/2005/01/learning_doesnt.html

I haven't taken a look at the Pickaxe 2, yet.

So I wouldn't feel bad after trying out Ruby for the first time, even
accompanied by some books. Just let the "old way of thinking" about
programming languages go.

Think about this: not all the Python interpreters, documentations and
libraries will help you become a true developer anymore than what's
available for Ruby, and vice-versa.

I'm not leaving Ruby for Python anytime soon. :)

Cheers,
Joao
 
B

Bill Kelly

Hi,

From: "Alexander Kellett said:
how can a variable confuse? its just a name. anyone who's done basic
algebra gets it straight away surely?

In theory... But there also exist people who have an
interest in learning some programming who either haven't
had algebra yet or for whom algebra is a loathsome bad
memory from high school that they've tried to forget.

In my wife's recent online introductory programming
course (using Visual Basic) she remembered just enough
math to be puzzled why '=' meant assignment now, instead
of equality. It didn't help that '=' in VB morphs
between assignment and equality depending on context. :(

She also disliked static typing. Why do I have to "Dim"
these things before I can use them?

Unfortunately the class didn't teach any of these
concepts; they just threw you in the forms designer
and had you double-click to get to your event handler
code (what's an event????).

Well anyway, my experience helping my wife with that class
has definitely reset most of my expectations about what
should or shouldn't be obvious to a beginner. Some
learners really are starting from a blank slate where even
the most fundamental concepts can't be taken for granted...


FWIW,

Regards,

Bill
 
J

James G. Britt

*putting on flame retardant pants*

As a noob to Ruby who was convinced to try it after reading why's
wonderful work, i will say that i find Ruby "harder" than Python. To
call Python a "joke of a language" is pretty harsh by the way.

It is not merely harsh; it is incorrect. Most people here prefer Ruby
to Python, but don't simply dismiss Python either.
It is
taking me much, much longer to work my way through the PickAxe book
than it did Learning Python. In just a few days of that book, I wrote
fully functional (albeit very tiny) applications that did what I
needed them to do. As well, at the time, the Python community was
helpful to the noob. Of course, Python doesn't have why, so it loses
on that aspect. :)

The Pickaxe is not the best Ruby intro for all people. It is a good
work, but (as with all such books) it makes certain assumptions about
prior experience and expectations that just can't be true for
everyone.
I did go and find a used copy of Learn Ruby in 21 Days and it does
seem to be a bit easier to get through so far, but the Ruby syntax is
a bit more work for me whereas in Python I feel like I'm writing
pseudo code that actually works. But that's just me, your average
newbie (or maybe to you I'm an idiot) , and it of course in no way
reflects on the writings mentioned, nor the language. And I do intend
to get through the Ruby books eventually....

If you aren't already familiar with the site, go poke around
http://www.ruby-doc.org, in particular
http://www.ruby-doc.org/docs/ruby-doc-bundle/
and
http://www.ruby-doc.org/docbar/



James
 

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
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top