

Issues faced by Ruby Beginners - satling
http://japhr.blogspot.com/2009/10/newbie-feedback.html
Chris Strom on the most common "issues" faced by Ruby beginners.
======
benofsky
I think Matz or some well known and respected "rubyist" needs to write a Ruby
equivalent of Python's Pep 8 (there are some style guides out there on the
internet but are mostly written in the "someone might disagree with me so here
are 5 options for doing x" style) as there are a lot of stylistic things which
ruby beginners always get slammed with.

For example, blocks or pseudo named paramaters with hashes are in no official
documentation (that I've found) recommended (or discouraged) over other
methods but a "rubyist" will often question a beginner over their use of x, y
or z.

Edit: clarification, spelling and grammar.

~~~
thenduks
While I'm not against having some of this stuff written down, Ruby purposely
adopts Perl's TMTOWTDI philosophy. So, using the while-loop approach is
perfectly valid.

Ruby beginners should use whichever way they find most agreeable and evolve
their view of the language as they go. Reading code written by other people
(respected rubyists, as you say) is a great (and, the recommended) way to pick
up new tricks to improve your code with.

IMO, that's the way it should be. There's no reason to list every single
little tip ('use inject instead of an external accumulator') somewhere since I
wouldn't expect a beginner to read through all that anyway.

When I learned Python several years ago I didn't know PEP's existed for ages,
I figured it out myself and I think I'm a better programmer for it.

~~~
mechanical_fish
_There's no reason to list every single little tip ('use inject instead of an
external accumulator') somewhere since I wouldn't expect a beginner to read
through all that anyway._

They might not read it on day one. But they will find themselves reading it
via Google after they read a line of code (written, perhaps, by a respected
Rubyist) that uses _inject_ and are trying to figure out how the idiom works
and where it should be used.

And, if they're lucky and they've found some fairly clear and concise docs,
they might bookmark that page, or even read the rest of the page while they're
there, thus saving themselves anywhere from 20 to 100 future trips to Stack
Overflow. ("What is this thing with the hash that we use to pass options? What
is this oddball "names.map(&:upcase)" syntax? What does "class << self" mean?
How come my colleagues laugh bitterly when I try to use Rails fixtures?")

~~~
benofsky
My point exactly.

------
omouse
Enumerable should read as 'iterator' and Smalltalk provides for and while
loops (though implemented differently) because they're useful.

The chaining isn't actually chaining. He really should know what the
evaluation order is. This is why it would be nice for people to read SICP, it
has a section on it: [http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-10.html...](http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-10.html#%_sec_Temp_22)

It would be much easier to learn Smalltalk than to deal with Ruby's weird
syntax shit and it's blocks/procs crap.

~~~
lonestar
I don't understand your point about chaining and evaluation order. The example
in the article is straightforward method chaining. Can you explain what you
mean?

------
petesalty
When I was learning Ruby an exercise I'd put myself through was to solve a
problem as best I could - that might have involved using a while loop for
example. Then I'd iterate over the problem, Rubyifying it as much as I could.
Sometimes I'd get stuck and have to ask for help, and sometimes I'd just spend
hours getting it wrong, but it really helped me understand the nuances of
Ruby. I actually still do this from time to time to keep my hand in, and I
usually end up learning something new.

