[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Why is it so difficult to learn Ruby for me ?

Paganoni

3/21/2009 3:43:00 PM

No, it's not a troll.

I love Ruby. I mean, this is the only language that I read and write
with a lot pleasure but I must be honest, I have also great difficulties
to learn it.

I'm 40+ years old, I used to be a geek but I'm no more. My knowledge is
deeply formated by old static languages. I learned Basic, then
Assembler, then Pascal. I discovered object programming with Pascal, and
over the years had some experiments with C++ and Java. I disliked C++, I
liked Java but I disliked the J2E environment. Even if J2E was bloated I
found Java programming principles very logical for me, very familiar.
In the meantime I did a lot of PHP (3 & 4) programming to earn money.

Then I discovered Ruby on Rails and loved it immediately. I never coded
in PHP since, and will never again. I'm not pro or cons any language, I
was just ultra fed up with the tools I used every day and RoR saved my
job. That was 3 years ago. Since, I've coded several web sites and
applications, each time using better practices and I'm pretty proud of
the cleanliness of my current works.

But my Ruby learning curve is still flat.

I'm still thinking in Ruby as I did in C++ or Java (as I did in Pascal
in fact). I tried countless times to learn Ruby concepts, but each time
they faded away from my mind few hours later. I've read books, plenty of
articles found on the web but I'm still at loss.

I even tried some Ruby Quiz but they imply a double effort : solve the
problem AND think in Ruby. Too much for me.

So, I'm more or less to the Pickaxe level. But a great part of the code
written by best Rubyist or Railers is very very far away from that and I
can read it easily (or even at all).


What can I do to improve my ruby skills ?
14 Answers

Robert Klemme

3/21/2009 4:24:00 PM

0

On 21.03.2009 16:43, Paganoni wrote:
> No, it's not a troll.
>
> I love Ruby. I mean, this is the only language that I read and write
> with a lot pleasure but I must be honest, I have also great difficulties
> to learn it.
>
> I'm 40+ years old, I used to be a geek but I'm no more. My knowledge is
> deeply formated by old static languages. I learned Basic, then
> Assembler, then Pascal. I discovered object programming with Pascal, and
> over the years had some experiments with C++ and Java. I disliked C++, I
> liked Java but I disliked the J2E environment. Even if J2E was bloated I
> found Java programming principles very logical for me, very familiar.
> In the meantime I did a lot of PHP (3 & 4) programming to earn money.
>
> Then I discovered Ruby on Rails and loved it immediately. I never coded
> in PHP since, and will never again. I'm not pro or cons any language, I
> was just ultra fed up with the tools I used every day and RoR saved my
> job. That was 3 years ago. Since, I've coded several web sites and
> applications, each time using better practices and I'm pretty proud of
> the cleanliness of my current works.
>
> But my Ruby learning curve is still flat.
>
> I'm still thinking in Ruby as I did in C++ or Java (as I did in Pascal
> in fact). I tried countless times to learn Ruby concepts, but each time
> they faded away from my mind few hours later. I've read books, plenty of
> articles found on the web but I'm still at loss.
>
> I even tried some Ruby Quiz but they imply a double effort : solve the
> problem AND think in Ruby. Too much for me.
>
> So, I'm more or less to the Pickaxe level. But a great part of the code
> written by best Rubyist or Railers is very very far away from that and I
> can read it easily (or even at all).
>
>
> What can I do to improve my ruby skills ?

That's a tough one as you seem to have exhausted pretty much every other
learning tool. Maybe you are underestimating your skills - at least you
managed to put several web applications into life.

Two ideas come to mind: try to get hands on a tutor that you can sit
together and maybe solve a few of those Ruby quizzes talking about the
code as you write it.

Another option would be to try to investigate which concepts you feel
you are failing to understand and ask specific questions over here.
Maybe you'll even find answers already by diving into the archives.

Hope that helps.

Kind regards

robert

Paganoni

3/21/2009 5:22:00 PM

0

le 21/03/2009 16:43, Paganoni nous a dit:

>
> So, I'm more or less to the Pickaxe level. But a great part of the code
> written by best Rubyist or Railers is very very far away from that and I
> can read it easily (or even at all).
>

Typo : I can'T read it easily (or even at all).

pjb

3/21/2009 5:25:00 PM

0

Paganoni <noway@fakenullvoid.com> writes:
> I'm still thinking in Ruby as I did in C++ or Java (as I did in Pascal
> in fact). I tried countless times to learn Ruby concepts, but each
> time they faded away from my mind few hours later. I've read books,
> plenty of articles found on the web but I'm still at loss.
> [...]
> What can I do to improve my ruby skills ?

- learn Smalltalk, or
- learn Scheme or Common-Lisp.

Actually, it may be enough for you to understand the fundamental
difference between the object-oriented programming language you know,
and Ruby, Smalltalk, Scheme, Lisp (and also Python, Perl and PHP):

In C++, Java or Pascal, the variables are typed: you cannot put in a
variable a value of a different type than the one declared for the
variable. This allow the compilers of these languages to _blindly_
apply an operation on the value stored in a variable, as long as this
operation is compatible with the type of that variable. Theorically,
it should be safe enough. In practice, there may be loopholes allowing
to store random bit patterns in variables and thus breaking the
programs (true mostly of C++, but it's easily done in Pascal too, less
easily in Java).

In Ruby, Smalltalk, Scheme, Lisp, etc, it's the _values_ that are
typed, variable are entirely untyped: you can assign any type of value
to any variable. The operations can and do check the type of the
values they're applied on and either implement generic behavior (do
something different for each type of value) or signal an error (at
run-time). Since it is impossible (or very hard) to have invalid bit
patterns in values, it's almost impossible to make programs break
(basically, you can do it when you have access to a "FFI" a Foreign
Function Interface which let you fall back to C-level programming and
all it's unsafeness).


Well to allow for OO polymorphism, statically typed programming
languages may implement partially such run-time value-dependent
dispatching of polymorph operations, so as long as you declare your
variables as being of type some root class, you can store in them
values of any subclass type (notice that in C++ there's no single root
class, you can have as many class hierarchies as you want, so you
cannot store instances of subclasses of another hierarchy. And in any
case, in these programming languages, there are types that are not
classes, the Plain Old Data types such as integer (even if as you know
Java defines corresponding classes).


In dynamically typed programming languages such as Ruby, Smalltalk,
Scheme, Lisp, etc, all the values have a class, even simple integers,
and operations can be dispatched on their class.


So basically, in Ruby (and other dynamically typed programming
languages), all the values are objects, and only objects have a type
(a class). Everything is an object (even classes and methods). And
since variables are not typed, you can define generic operations that
work on more than one type of values, even classes that are not
defined at the time you write the operation. This is what let these
language be very extensible.




--
__Pascal Bourguignon__

Paganoni

3/22/2009 11:27:00 AM

0

le 21/03/2009 17:24, Robert Klemme nous a dit:

>
> That's a tough one as you seem to have exhausted pretty much every other
> learning tool. Maybe you are underestimating your skills - at least you
> managed to put several web applications into life.
>
> Two ideas come to mind: try to get hands on a tutor that you can sit
> together and maybe solve a few of those Ruby quizzes talking about the
> code as you write it.
>
> Another option would be to try to investigate which concepts you feel
> you are failing to understand and ask specific questions over here.
> Maybe you'll even find answers already by diving into the archives.
>

Yes, these applications are up & running. The next one will be quite big
(at least for me). But it seems that I'm always polishing Rail's concept
without enhancing Ruby's concepts.

The idea of a tutor is good, but unfortunately there are none around
here...

About investigating some concepts : In fact, it's more a practice
problem than an understanding problem. For example, I understand
closures, even if subtleties are out of reach, but I never use them
because I'm so "static language" formatted that no ideas come to me on
everyday use.

Same with methods definitions : I understand that a method can be
defined to a class, all the instances or a specific instance (become a
duck) but 100% of the time I'm defining methods like I would do in Java.
And my classes never "mutilate" themselves as some well known Ruby
software does.

May be I should find good books, like "Design Patterns in Ruby"... Do
you have some references of books going quite far with some care for old
programmers like me :-) ?


Paganoni

3/22/2009 11:30:00 AM

0

le 21/03/2009 18:25, Pascal J. Bourguignon nous a dit:
> Paganoni <noway@fakenullvoid.com> writes:
>> I'm still thinking in Ruby as I did in C++ or Java (as I did in Pascal
>> in fact). I tried countless times to learn Ruby concepts, but each
>> time they faded away from my mind few hours later. I've read books,
>> plenty of articles found on the web but I'm still at loss.
>> [...]
>> What can I do to improve my ruby skills ?
>
> - learn Smalltalk, or
> - learn Scheme or Common-Lisp.
>
> Actually, it may be enough for you to understand the fundamental
> difference between the object-oriented programming language you know,
> and Ruby, Smalltalk, Scheme, Lisp (and also Python, Perl and PHP):
>
>

Your answer is quite surprising to me. Why do you tell me to learn one
of those languages instead of learning Ruby ? I know that they
historically provided most of the concepts of modern languages but why
not to learn them with Ruby ?

Phlip

3/22/2009 12:00:00 PM

0

Paganoni wrote:

> May be I should find good books, like "Design Patterns in Ruby"... Do
> you have some references of books going quite far with some care for old
> programmers like me :-) ?

My favorite answer in these forums is: "How are your unit tests?"

You just can't underestimate their impact on your mindset...

Phlip

3/22/2009 12:24:00 PM

0

Paganoni wrote:

> Your answer is quite surprising to me. Why do you tell me to learn one
> of those languages instead of learning Ruby ? I know that they
> historically provided most of the concepts of modern languages but why
> not to learn them with Ruby ?

Because the first, deepest schism in the OO languages are between the Incorrect
ones and the Correct ones. (Aka Static Typing and Dynamic Typing, respectively.)

Dynamic Typing ("Duck Typing") is about emergent behavior, whereas Static Typing
is about negative reinforcement - investing your fear of emergent behavior into
all kinds of restrictions in your code.

So learn other Duck Typing languages, too...

--
Phlip

Robert Klemme

3/22/2009 12:37:00 PM

0

On 22.03.2009 12:27, Paganoni wrote:

> Yes, these applications are up & running. The next one will be quite big
> (at least for me). But it seems that I'm always polishing Rail's concept
> without enhancing Ruby's concepts.

Maybe that's not needed for the types of applications you do. Who knows?

> The idea of a tutor is good, but unfortunately there are none around here...

Maybe you just post a piece of code here that you feel is not well
crafted and listen to the responses you get.

> About investigating some concepts : In fact, it's more a practice
> problem than an understanding problem. For example, I understand
> closures, even if subtleties are out of reach, but I never use them
> because I'm so "static language" formatted that no ideas come to me on
> everyday use.

Maybe your problems do not lend themselves to being treated with
closures. Use the right tool for the job. I mean, you do not have to
have all design patterns in one application, do you? Use what works and
fits the situation. If you discover that it doesn't work or does not
work too well, look for another tool.

> Same with methods definitions : I understand that a method can be
> defined to a class, all the instances or a specific instance (become a
> duck) but 100% of the time I'm defining methods like I would do in Java.

The difference is not that big: in Java you can define methods for
classes (static) and instances (non static). The role that class level
and instance level methods play in all OO languages is roughly the same.

> And my classes never "mutilate" themselves as some well known Ruby
> software does.
>
> May be I should find good books, like "Design Patterns in Ruby"... Do
> you have some references of books going quite far with some care for old
> programmers like me :-) ?

IIRC there was a recommendation recently here (less than two months
ago). I'm sure you can dig that up by looking for "patterns".

Kind regards

robert

Robert Klemme

3/22/2009 1:23:00 PM

0

On 22.03.2009 13:24, Phlip wrote:
> Paganoni wrote:
>
>> Your answer is quite surprising to me. Why do you tell me to learn one
>> of those languages instead of learning Ruby ? I know that they
>> historically provided most of the concepts of modern languages but why
>> not to learn them with Ruby ?
>
> Because the first, deepest schism in the OO languages are between the
> Incorrect ones and the Correct ones. (Aka Static Typing and Dynamic
> Typing, respectively.)
>
> Dynamic Typing ("Duck Typing") is about emergent behavior, whereas
> Static Typing is about negative reinforcement - investing your fear of
> emergent behavior into all kinds of restrictions in your code.

That's a bit too much psychological terminology for my taste. Both
approaches have pros and cons, deeming one of them "incorrect" is not
fair and not helpful as well. Defensiveness can be a virtue in some
cases, in other it hinders productivity. For example, I tend to believe
that you can write very robust and bug free software with design by
contract. This is not necessarily fast but there are areas of software
engineering where robustness is paramount while time to market isn't.

Having said that I do support the point that learning more languages is
helpful because it fills your "toolbox". Whether it is helpful for OP I
am not sure.

Cheers

robert

Paganoni

3/22/2009 1:58:00 PM

0

le 22/03/2009 13:00, Phlip nous a dit:
> Paganoni wrote:
>
>> May be I should find good books, like "Design Patterns in Ruby"... Do
>> you have some references of books going quite far with some care for
>> old programmers like me :-) ?
>
> My favorite answer in these forums is: "How are your unit tests?"
>
> You just can't underestimate their impact on your mindset...

I unit test the most I can under RoR (it means more and more with wy the
improvement of my RoR skills) but I never unit test nothing when I'm
just trying to play with Ruby to understand some of its features...

Should I ?